Bug Summary

File:build/source/build-llvm/tools/clang/include/clang/Basic/riscv_vector_builtin_cg.inc
Warning:line 1538, column 3
Value stored to 'PolicyAttrs' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name CGBuiltin.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -mframe-pointer=none -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -ffunction-sections -fdata-sections -fcoverage-compilation-dir=/build/source/build-llvm -resource-dir /usr/lib/llvm-17/lib/clang/17 -I tools/clang/lib/CodeGen -I /build/source/clang/lib/CodeGen -I /build/source/clang/include -I tools/clang/include -I include -I /build/source/llvm/include -D _DEBUG -D _GLIBCXX_ASSERTIONS -D _GNU_SOURCE -D _LIBCPP_ENABLE_ASSERTIONS -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D _FORTIFY_SOURCE=2 -D NDEBUG -U NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward -internal-isystem /usr/lib/llvm-17/lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/build/source/build-llvm=build-llvm -fmacro-prefix-map=/build/source/= -fcoverage-prefix-map=/build/source/build-llvm=build-llvm -fcoverage-prefix-map=/build/source/= -source-date-epoch 1678706029 -O3 -Wno-unused-command-line-argument -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-comment -Wno-misleading-indentation -std=c++17 -fdeprecated-macro -fdebug-compilation-dir=/build/source/build-llvm -fdebug-prefix-map=/build/source/build-llvm=build-llvm -fdebug-prefix-map=/build/source/= -fdebug-prefix-map=/build/source/build-llvm=build-llvm -fdebug-prefix-map=/build/source/= -ferror-limit 19 -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2023-03-13-125747-16495-1 -x c++ /build/source/clang/lib/CodeGen/CGBuiltin.cpp
1case RISCVVector::BI__builtin_rvv_vget_v:
2 PolicyAttrs = 3;
3IsMasked = false;
4
5 {
6 ID = Intrinsic::vector_extract;
7 auto *VecTy = cast<ScalableVectorType>(ResultType);
8 auto *OpVecTy = cast<ScalableVectorType>(Ops[0]->getType());
9 // Mask to only valid indices.
10 unsigned MaxIndex = OpVecTy->getMinNumElements() / VecTy->getMinNumElements();
11 assert(isPowerOf2_32(MaxIndex))(static_cast <bool> (isPowerOf2_32(MaxIndex)) ? void (0
) : __assert_fail ("isPowerOf2_32(MaxIndex)", "tools/clang/include/clang/Basic/riscv_vector_builtin_cg.inc"
, 11, __extension__ __PRETTY_FUNCTION__))
;
12 Ops[1] = Builder.CreateZExt(Ops[1], Builder.getInt64Ty());
13 Ops[1] = Builder.CreateAnd(Ops[1], MaxIndex - 1);
14 Ops[1] = Builder.CreateMul(Ops[1],
15 ConstantInt::get(Ops[1]->getType(),
16 VecTy->getMinNumElements()));
17 IntrinsicTypes = {ResultType, Ops[0]->getType()};
18 return Builder.CreateCall(CGM.getIntrinsic(ID, IntrinsicTypes), Ops, "");
19 }
20 break;
21case RISCVVector::BI__builtin_rvv_vset_v:
22 PolicyAttrs = 3;
23IsMasked = false;
24
25 {
26 ID = Intrinsic::vector_insert;
27 IntrinsicTypes = {ResultType, Ops[2]->getType()};
28 auto *ResVecTy = cast<ScalableVectorType>(ResultType);
29 auto *VecTy = cast<ScalableVectorType>(Ops[2]->getType());
30 // Mask to only valid indices.
31 unsigned MaxIndex = ResVecTy->getMinNumElements() / VecTy->getMinNumElements();
32 assert(isPowerOf2_32(MaxIndex))(static_cast <bool> (isPowerOf2_32(MaxIndex)) ? void (0
) : __assert_fail ("isPowerOf2_32(MaxIndex)", "tools/clang/include/clang/Basic/riscv_vector_builtin_cg.inc"
, 32, __extension__ __PRETTY_FUNCTION__))
;
33 Ops[1] = Builder.CreateZExt(Ops[1], Builder.getInt64Ty());
34 Ops[1] = Builder.CreateAnd(Ops[1], MaxIndex - 1);
35 Ops[1] = Builder.CreateMul(Ops[1],
36 ConstantInt::get(Ops[1]->getType(),
37 VecTy->getMinNumElements()));
38 std::swap(Ops[1], Ops[2]);
39 return Builder.CreateCall(CGM.getIntrinsic(ID, IntrinsicTypes), Ops, "");
40 }
41 break;
42case RISCVVector::BI__builtin_rvv_vlenb:
43 PolicyAttrs = 3;
44IsMasked = false;
45
46 {
47 LLVMContext &Context = CGM.getLLVMContext();
48 llvm::MDBuilder MDHelper(Context);
49
50 llvm::Metadata *Ops[] = {llvm::MDString::get(Context, "vlenb")};
51 llvm::MDNode *RegName = llvm::MDNode::get(Context, Ops);
52 llvm::Value *Metadata = llvm::MetadataAsValue::get(Context, RegName);
53 llvm::Function *F =
54 CGM.getIntrinsic(llvm::Intrinsic::read_register, {SizeTy});
55 return Builder.CreateCall(F, Metadata);
56 }
57 break;
58case RISCVVector::BI__builtin_rvv_vlmul_ext_v:
59 PolicyAttrs = 3;
60IsMasked = false;
61
62 ID = Intrinsic::vector_insert;
63 IntrinsicTypes = {ResultType, Ops[0]->getType()};
64 Ops.push_back(llvm::PoisonValue::get(ResultType));
65 std::swap(Ops[0], Ops[1]);
66 Ops.push_back(ConstantInt::get(Int64Ty, 0));
67 return Builder.CreateCall(CGM.getIntrinsic(ID, IntrinsicTypes), Ops, "");
68 break;
69case RISCVVector::BI__builtin_rvv_vlmul_trunc_v:
70 PolicyAttrs = 3;
71IsMasked = false;
72 {
73 ID = Intrinsic::vector_extract;
74 IntrinsicTypes = {ResultType, Ops[0]->getType()};
75 Ops.push_back(ConstantInt::get(Int64Ty, 0));
76 return Builder.CreateCall(CGM.getIntrinsic(ID, IntrinsicTypes), Ops, "");
77 } break;
78case RISCVVector::BI__builtin_rvv_vreinterpret_v:
79 PolicyAttrs = 3;
80IsMasked = false;
81
82 return Builder.CreateBitCast(Ops[0], ResultType);
83 break;
84case RISCVVector::BI__builtin_rvv_vundefined:
85 PolicyAttrs = 3;
86IsMasked = false;
87
88 return llvm::PoisonValue::get(ResultType);
89 break;
90case RISCVVector::BI__builtin_rvv_vaadd_vv_tu:
91case RISCVVector::BI__builtin_rvv_vaadd_vx_tu:
92 ID = Intrinsic::riscv_vaadd;
93 PolicyAttrs = 2;
94 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
95 break;
96case RISCVVector::BI__builtin_rvv_vaadd_vv_ta:
97case RISCVVector::BI__builtin_rvv_vaadd_vx_ta:
98 ID = Intrinsic::riscv_vaadd;
99 PolicyAttrs = 3;
100 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
101 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
102 break;
103case RISCVVector::BI__builtin_rvv_vaadd_vv_tum:
104case RISCVVector::BI__builtin_rvv_vaadd_vx_tum:
105 ID = Intrinsic::riscv_vaadd_mask;
106 PolicyAttrs = 2;
107 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
108 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
109 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
110 break;
111case RISCVVector::BI__builtin_rvv_vaadd_vv_tama:
112case RISCVVector::BI__builtin_rvv_vaadd_vx_tama:
113 ID = Intrinsic::riscv_vaadd_mask;
114 PolicyAttrs = 3;
115 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
116 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
117 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
118 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
119 break;
120case RISCVVector::BI__builtin_rvv_vaadd_vv_tumu:
121case RISCVVector::BI__builtin_rvv_vaadd_vx_tumu:
122 ID = Intrinsic::riscv_vaadd_mask;
123 PolicyAttrs = 0;
124 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
125 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
126 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
127 break;
128case RISCVVector::BI__builtin_rvv_vaadd_vv_mu:
129case RISCVVector::BI__builtin_rvv_vaadd_vx_mu:
130 ID = Intrinsic::riscv_vaadd_mask;
131 PolicyAttrs = 1;
132 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
133 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
134 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
135 break;
136case RISCVVector::BI__builtin_rvv_vaaddu_vv_tu:
137case RISCVVector::BI__builtin_rvv_vaaddu_vx_tu:
138 ID = Intrinsic::riscv_vaaddu;
139 PolicyAttrs = 2;
140 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
141 break;
142case RISCVVector::BI__builtin_rvv_vaaddu_vv_ta:
143case RISCVVector::BI__builtin_rvv_vaaddu_vx_ta:
144 ID = Intrinsic::riscv_vaaddu;
145 PolicyAttrs = 3;
146 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
147 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
148 break;
149case RISCVVector::BI__builtin_rvv_vaaddu_vv_tum:
150case RISCVVector::BI__builtin_rvv_vaaddu_vx_tum:
151 ID = Intrinsic::riscv_vaaddu_mask;
152 PolicyAttrs = 2;
153 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
154 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
155 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
156 break;
157case RISCVVector::BI__builtin_rvv_vaaddu_vv_tama:
158case RISCVVector::BI__builtin_rvv_vaaddu_vx_tama:
159 ID = Intrinsic::riscv_vaaddu_mask;
160 PolicyAttrs = 3;
161 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
162 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
163 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
164 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
165 break;
166case RISCVVector::BI__builtin_rvv_vaaddu_vv_tumu:
167case RISCVVector::BI__builtin_rvv_vaaddu_vx_tumu:
168 ID = Intrinsic::riscv_vaaddu_mask;
169 PolicyAttrs = 0;
170 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
171 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
172 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
173 break;
174case RISCVVector::BI__builtin_rvv_vaaddu_vv_mu:
175case RISCVVector::BI__builtin_rvv_vaaddu_vx_mu:
176 ID = Intrinsic::riscv_vaaddu_mask;
177 PolicyAttrs = 1;
178 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
179 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
180 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
181 break;
182case RISCVVector::BI__builtin_rvv_vadc_vvm_tu:
183case RISCVVector::BI__builtin_rvv_vadc_vxm_tu:
184 ID = Intrinsic::riscv_vadc;
185 PolicyAttrs = 2;
186 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
187 break;
188case RISCVVector::BI__builtin_rvv_vadc_vvm_ta:
189case RISCVVector::BI__builtin_rvv_vadc_vxm_ta:
190 ID = Intrinsic::riscv_vadc;
191 PolicyAttrs = 3;
192 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
193 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
194 break;
195case RISCVVector::BI__builtin_rvv_vadd_vv_tu:
196case RISCVVector::BI__builtin_rvv_vadd_vx_tu:
197 ID = Intrinsic::riscv_vadd;
198 PolicyAttrs = 2;
199 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
200 break;
201case RISCVVector::BI__builtin_rvv_vadd_vv_ta:
202case RISCVVector::BI__builtin_rvv_vadd_vx_ta:
203 ID = Intrinsic::riscv_vadd;
204 PolicyAttrs = 3;
205 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
206 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
207 break;
208case RISCVVector::BI__builtin_rvv_vadd_vv_tum:
209case RISCVVector::BI__builtin_rvv_vadd_vx_tum:
210 ID = Intrinsic::riscv_vadd_mask;
211 PolicyAttrs = 2;
212 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
213 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
214 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
215 break;
216case RISCVVector::BI__builtin_rvv_vadd_vv_tama:
217case RISCVVector::BI__builtin_rvv_vadd_vx_tama:
218 ID = Intrinsic::riscv_vadd_mask;
219 PolicyAttrs = 3;
220 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
221 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
222 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
223 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
224 break;
225case RISCVVector::BI__builtin_rvv_vadd_vv_tumu:
226case RISCVVector::BI__builtin_rvv_vadd_vx_tumu:
227 ID = Intrinsic::riscv_vadd_mask;
228 PolicyAttrs = 0;
229 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
230 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
231 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
232 break;
233case RISCVVector::BI__builtin_rvv_vadd_vv_mu:
234case RISCVVector::BI__builtin_rvv_vadd_vx_mu:
235 ID = Intrinsic::riscv_vadd_mask;
236 PolicyAttrs = 1;
237 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
238 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
239 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
240 break;
241case RISCVVector::BI__builtin_rvv_vand_vv_tu:
242case RISCVVector::BI__builtin_rvv_vand_vx_tu:
243 ID = Intrinsic::riscv_vand;
244 PolicyAttrs = 2;
245 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
246 break;
247case RISCVVector::BI__builtin_rvv_vand_vv_ta:
248case RISCVVector::BI__builtin_rvv_vand_vx_ta:
249 ID = Intrinsic::riscv_vand;
250 PolicyAttrs = 3;
251 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
252 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
253 break;
254case RISCVVector::BI__builtin_rvv_vand_vv_tum:
255case RISCVVector::BI__builtin_rvv_vand_vx_tum:
256 ID = Intrinsic::riscv_vand_mask;
257 PolicyAttrs = 2;
258 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
259 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
260 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
261 break;
262case RISCVVector::BI__builtin_rvv_vand_vv_tama:
263case RISCVVector::BI__builtin_rvv_vand_vx_tama:
264 ID = Intrinsic::riscv_vand_mask;
265 PolicyAttrs = 3;
266 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
267 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
268 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
269 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
270 break;
271case RISCVVector::BI__builtin_rvv_vand_vv_tumu:
272case RISCVVector::BI__builtin_rvv_vand_vx_tumu:
273 ID = Intrinsic::riscv_vand_mask;
274 PolicyAttrs = 0;
275 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
276 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
277 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
278 break;
279case RISCVVector::BI__builtin_rvv_vand_vv_mu:
280case RISCVVector::BI__builtin_rvv_vand_vx_mu:
281 ID = Intrinsic::riscv_vand_mask;
282 PolicyAttrs = 1;
283 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
284 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
285 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
286 break;
287case RISCVVector::BI__builtin_rvv_vasub_vv_tu:
288case RISCVVector::BI__builtin_rvv_vasub_vx_tu:
289 ID = Intrinsic::riscv_vasub;
290 PolicyAttrs = 2;
291 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
292 break;
293case RISCVVector::BI__builtin_rvv_vasub_vv_ta:
294case RISCVVector::BI__builtin_rvv_vasub_vx_ta:
295 ID = Intrinsic::riscv_vasub;
296 PolicyAttrs = 3;
297 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
298 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
299 break;
300case RISCVVector::BI__builtin_rvv_vasub_vv_tum:
301case RISCVVector::BI__builtin_rvv_vasub_vx_tum:
302 ID = Intrinsic::riscv_vasub_mask;
303 PolicyAttrs = 2;
304 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
305 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
306 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
307 break;
308case RISCVVector::BI__builtin_rvv_vasub_vv_tama:
309case RISCVVector::BI__builtin_rvv_vasub_vx_tama:
310 ID = Intrinsic::riscv_vasub_mask;
311 PolicyAttrs = 3;
312 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
313 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
314 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
315 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
316 break;
317case RISCVVector::BI__builtin_rvv_vasub_vv_tumu:
318case RISCVVector::BI__builtin_rvv_vasub_vx_tumu:
319 ID = Intrinsic::riscv_vasub_mask;
320 PolicyAttrs = 0;
321 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
322 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
323 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
324 break;
325case RISCVVector::BI__builtin_rvv_vasub_vv_mu:
326case RISCVVector::BI__builtin_rvv_vasub_vx_mu:
327 ID = Intrinsic::riscv_vasub_mask;
328 PolicyAttrs = 1;
329 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
330 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
331 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
332 break;
333case RISCVVector::BI__builtin_rvv_vasubu_vv_tu:
334case RISCVVector::BI__builtin_rvv_vasubu_vx_tu:
335 ID = Intrinsic::riscv_vasubu;
336 PolicyAttrs = 2;
337 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
338 break;
339case RISCVVector::BI__builtin_rvv_vasubu_vv_ta:
340case RISCVVector::BI__builtin_rvv_vasubu_vx_ta:
341 ID = Intrinsic::riscv_vasubu;
342 PolicyAttrs = 3;
343 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
344 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
345 break;
346case RISCVVector::BI__builtin_rvv_vasubu_vv_tum:
347case RISCVVector::BI__builtin_rvv_vasubu_vx_tum:
348 ID = Intrinsic::riscv_vasubu_mask;
349 PolicyAttrs = 2;
350 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
351 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
352 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
353 break;
354case RISCVVector::BI__builtin_rvv_vasubu_vv_tama:
355case RISCVVector::BI__builtin_rvv_vasubu_vx_tama:
356 ID = Intrinsic::riscv_vasubu_mask;
357 PolicyAttrs = 3;
358 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
359 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
360 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
361 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
362 break;
363case RISCVVector::BI__builtin_rvv_vasubu_vv_tumu:
364case RISCVVector::BI__builtin_rvv_vasubu_vx_tumu:
365 ID = Intrinsic::riscv_vasubu_mask;
366 PolicyAttrs = 0;
367 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
368 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
369 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
370 break;
371case RISCVVector::BI__builtin_rvv_vasubu_vv_mu:
372case RISCVVector::BI__builtin_rvv_vasubu_vx_mu:
373 ID = Intrinsic::riscv_vasubu_mask;
374 PolicyAttrs = 1;
375 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
376 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
377 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
378 break;
379case RISCVVector::BI__builtin_rvv_vcompress_vm_tu:
380 ID = Intrinsic::riscv_vcompress;
381 PolicyAttrs = 2;
382IsMasked = false;
383
384 // insert poison passthru
385 if (PolicyAttrs & RVV_VTA)
386 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
387 IntrinsicTypes = {ResultType, Ops.back()->getType()};
388 break;
389case RISCVVector::BI__builtin_rvv_vcompress_vm_ta:
390 ID = Intrinsic::riscv_vcompress;
391 PolicyAttrs = 3;
392IsMasked = false;
393
394 // insert poison passthru
395 if (PolicyAttrs & RVV_VTA)
396 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
397 IntrinsicTypes = {ResultType, Ops.back()->getType()};
398 break;
399case RISCVVector::BI__builtin_rvv_vcpop_m:
400 ID = Intrinsic::riscv_vcpop;
401 PolicyAttrs = 3;
402 IntrinsicTypes = {Ops[0]->getType(), Ops.back()->getType()};
403 break;
404case RISCVVector::BI__builtin_rvv_vcpop_m_m:
405 ID = Intrinsic::riscv_vcpop_mask;
406 PolicyAttrs = 3;
407 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
408 IntrinsicTypes = {Ops[0]->getType(), Ops.back()->getType()};
409 break;
410case RISCVVector::BI__builtin_rvv_vdiv_vv_tu:
411case RISCVVector::BI__builtin_rvv_vdiv_vx_tu:
412 ID = Intrinsic::riscv_vdiv;
413 PolicyAttrs = 2;
414 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
415 break;
416case RISCVVector::BI__builtin_rvv_vdiv_vv_ta:
417case RISCVVector::BI__builtin_rvv_vdiv_vx_ta:
418 ID = Intrinsic::riscv_vdiv;
419 PolicyAttrs = 3;
420 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
421 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
422 break;
423case RISCVVector::BI__builtin_rvv_vdiv_vv_tum:
424case RISCVVector::BI__builtin_rvv_vdiv_vx_tum:
425 ID = Intrinsic::riscv_vdiv_mask;
426 PolicyAttrs = 2;
427 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
428 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
429 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
430 break;
431case RISCVVector::BI__builtin_rvv_vdiv_vv_tama:
432case RISCVVector::BI__builtin_rvv_vdiv_vx_tama:
433 ID = Intrinsic::riscv_vdiv_mask;
434 PolicyAttrs = 3;
435 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
436 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
437 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
438 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
439 break;
440case RISCVVector::BI__builtin_rvv_vdiv_vv_tumu:
441case RISCVVector::BI__builtin_rvv_vdiv_vx_tumu:
442 ID = Intrinsic::riscv_vdiv_mask;
443 PolicyAttrs = 0;
444 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
445 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
446 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
447 break;
448case RISCVVector::BI__builtin_rvv_vdiv_vv_mu:
449case RISCVVector::BI__builtin_rvv_vdiv_vx_mu:
450 ID = Intrinsic::riscv_vdiv_mask;
451 PolicyAttrs = 1;
452 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
453 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
454 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
455 break;
456case RISCVVector::BI__builtin_rvv_vdivu_vv_tu:
457case RISCVVector::BI__builtin_rvv_vdivu_vx_tu:
458 ID = Intrinsic::riscv_vdivu;
459 PolicyAttrs = 2;
460 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
461 break;
462case RISCVVector::BI__builtin_rvv_vdivu_vv_ta:
463case RISCVVector::BI__builtin_rvv_vdivu_vx_ta:
464 ID = Intrinsic::riscv_vdivu;
465 PolicyAttrs = 3;
466 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
467 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
468 break;
469case RISCVVector::BI__builtin_rvv_vdivu_vv_tum:
470case RISCVVector::BI__builtin_rvv_vdivu_vx_tum:
471 ID = Intrinsic::riscv_vdivu_mask;
472 PolicyAttrs = 2;
473 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
474 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
475 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
476 break;
477case RISCVVector::BI__builtin_rvv_vdivu_vv_tama:
478case RISCVVector::BI__builtin_rvv_vdivu_vx_tama:
479 ID = Intrinsic::riscv_vdivu_mask;
480 PolicyAttrs = 3;
481 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
482 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
483 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
484 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
485 break;
486case RISCVVector::BI__builtin_rvv_vdivu_vv_tumu:
487case RISCVVector::BI__builtin_rvv_vdivu_vx_tumu:
488 ID = Intrinsic::riscv_vdivu_mask;
489 PolicyAttrs = 0;
490 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
491 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
492 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
493 break;
494case RISCVVector::BI__builtin_rvv_vdivu_vv_mu:
495case RISCVVector::BI__builtin_rvv_vdivu_vx_mu:
496 ID = Intrinsic::riscv_vdivu_mask;
497 PolicyAttrs = 1;
498 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
499 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
500 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
501 break;
502case RISCVVector::BI__builtin_rvv_vfadd_vv_tu:
503case RISCVVector::BI__builtin_rvv_vfadd_vf_tu:
504 ID = Intrinsic::riscv_vfadd;
505 PolicyAttrs = 2;
506 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
507 break;
508case RISCVVector::BI__builtin_rvv_vfadd_vv_ta:
509case RISCVVector::BI__builtin_rvv_vfadd_vf_ta:
510 ID = Intrinsic::riscv_vfadd;
511 PolicyAttrs = 3;
512 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
513 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
514 break;
515case RISCVVector::BI__builtin_rvv_vfadd_vv_tum:
516case RISCVVector::BI__builtin_rvv_vfadd_vf_tum:
517 ID = Intrinsic::riscv_vfadd_mask;
518 PolicyAttrs = 2;
519 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
520 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
521 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
522 break;
523case RISCVVector::BI__builtin_rvv_vfadd_vv_tama:
524case RISCVVector::BI__builtin_rvv_vfadd_vf_tama:
525 ID = Intrinsic::riscv_vfadd_mask;
526 PolicyAttrs = 3;
527 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
528 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
529 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
530 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
531 break;
532case RISCVVector::BI__builtin_rvv_vfadd_vv_tumu:
533case RISCVVector::BI__builtin_rvv_vfadd_vf_tumu:
534 ID = Intrinsic::riscv_vfadd_mask;
535 PolicyAttrs = 0;
536 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
537 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
538 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
539 break;
540case RISCVVector::BI__builtin_rvv_vfadd_vv_mu:
541case RISCVVector::BI__builtin_rvv_vfadd_vf_mu:
542 ID = Intrinsic::riscv_vfadd_mask;
543 PolicyAttrs = 1;
544 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
545 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
546 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
547 break;
548case RISCVVector::BI__builtin_rvv_vfclass_v_tu:
549 ID = Intrinsic::riscv_vfclass;
550 PolicyAttrs = 2;
551 IntrinsicTypes = {Ops[1]->getType(), Ops.back()->getType()};
552 break;
553case RISCVVector::BI__builtin_rvv_vfclass_v_ta:
554 ID = Intrinsic::riscv_vfclass;
555 PolicyAttrs = 3;
556 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
557 IntrinsicTypes = {Ops[1]->getType(), Ops.back()->getType()};
558 break;
559case RISCVVector::BI__builtin_rvv_vfclass_v_tum:
560 ID = Intrinsic::riscv_vfclass_mask;
561 PolicyAttrs = 2;
562 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
563 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
564 IntrinsicTypes = {Ops[1]->getType(), Ops.back()->getType()};
565 break;
566case RISCVVector::BI__builtin_rvv_vfclass_v_tama:
567 ID = Intrinsic::riscv_vfclass_mask;
568 PolicyAttrs = 3;
569 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
570 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
571 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
572 IntrinsicTypes = {Ops[1]->getType(), Ops.back()->getType()};
573 break;
574case RISCVVector::BI__builtin_rvv_vfclass_v_tumu:
575 ID = Intrinsic::riscv_vfclass_mask;
576 PolicyAttrs = 0;
577 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
578 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
579 IntrinsicTypes = {Ops[1]->getType(), Ops.back()->getType()};
580 break;
581case RISCVVector::BI__builtin_rvv_vfclass_v_mu:
582 ID = Intrinsic::riscv_vfclass_mask;
583 PolicyAttrs = 1;
584 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
585 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
586 IntrinsicTypes = {Ops[1]->getType(), Ops.back()->getType()};
587 break;
588case RISCVVector::BI__builtin_rvv_vfcvt_f_x_v_tu:
589 ID = Intrinsic::riscv_vfcvt_f_x_v;
590 PolicyAttrs = 2;
591 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
592 break;
593case RISCVVector::BI__builtin_rvv_vfcvt_f_x_v_ta:
594 ID = Intrinsic::riscv_vfcvt_f_x_v;
595 PolicyAttrs = 3;
596 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
597 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
598 break;
599case RISCVVector::BI__builtin_rvv_vfcvt_f_x_v_tum:
600 ID = Intrinsic::riscv_vfcvt_f_x_v_mask;
601 PolicyAttrs = 2;
602 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
603 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
604 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
605 break;
606case RISCVVector::BI__builtin_rvv_vfcvt_f_x_v_tama:
607 ID = Intrinsic::riscv_vfcvt_f_x_v_mask;
608 PolicyAttrs = 3;
609 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
610 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
611 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
612 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
613 break;
614case RISCVVector::BI__builtin_rvv_vfcvt_f_x_v_tumu:
615 ID = Intrinsic::riscv_vfcvt_f_x_v_mask;
616 PolicyAttrs = 0;
617 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
618 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
619 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
620 break;
621case RISCVVector::BI__builtin_rvv_vfcvt_f_x_v_mu:
622 ID = Intrinsic::riscv_vfcvt_f_x_v_mask;
623 PolicyAttrs = 1;
624 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
625 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
626 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
627 break;
628case RISCVVector::BI__builtin_rvv_vfcvt_f_xu_v_tu:
629 ID = Intrinsic::riscv_vfcvt_f_xu_v;
630 PolicyAttrs = 2;
631 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
632 break;
633case RISCVVector::BI__builtin_rvv_vfcvt_f_xu_v_ta:
634 ID = Intrinsic::riscv_vfcvt_f_xu_v;
635 PolicyAttrs = 3;
636 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
637 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
638 break;
639case RISCVVector::BI__builtin_rvv_vfcvt_f_xu_v_tum:
640 ID = Intrinsic::riscv_vfcvt_f_xu_v_mask;
641 PolicyAttrs = 2;
642 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
643 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
644 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
645 break;
646case RISCVVector::BI__builtin_rvv_vfcvt_f_xu_v_tama:
647 ID = Intrinsic::riscv_vfcvt_f_xu_v_mask;
648 PolicyAttrs = 3;
649 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
650 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
651 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
652 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
653 break;
654case RISCVVector::BI__builtin_rvv_vfcvt_f_xu_v_tumu:
655 ID = Intrinsic::riscv_vfcvt_f_xu_v_mask;
656 PolicyAttrs = 0;
657 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
658 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
659 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
660 break;
661case RISCVVector::BI__builtin_rvv_vfcvt_f_xu_v_mu:
662 ID = Intrinsic::riscv_vfcvt_f_xu_v_mask;
663 PolicyAttrs = 1;
664 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
665 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
666 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
667 break;
668case RISCVVector::BI__builtin_rvv_vfcvt_rtz_x_f_v_tu:
669 ID = Intrinsic::riscv_vfcvt_rtz_x_f_v;
670 PolicyAttrs = 2;
671 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
672 break;
673case RISCVVector::BI__builtin_rvv_vfcvt_rtz_x_f_v_ta:
674 ID = Intrinsic::riscv_vfcvt_rtz_x_f_v;
675 PolicyAttrs = 3;
676 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
677 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
678 break;
679case RISCVVector::BI__builtin_rvv_vfcvt_rtz_x_f_v_tum:
680 ID = Intrinsic::riscv_vfcvt_rtz_x_f_v_mask;
681 PolicyAttrs = 2;
682 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
683 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
684 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
685 break;
686case RISCVVector::BI__builtin_rvv_vfcvt_rtz_x_f_v_tama:
687 ID = Intrinsic::riscv_vfcvt_rtz_x_f_v_mask;
688 PolicyAttrs = 3;
689 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
690 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
691 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
692 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
693 break;
694case RISCVVector::BI__builtin_rvv_vfcvt_rtz_x_f_v_tumu:
695 ID = Intrinsic::riscv_vfcvt_rtz_x_f_v_mask;
696 PolicyAttrs = 0;
697 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
698 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
699 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
700 break;
701case RISCVVector::BI__builtin_rvv_vfcvt_rtz_x_f_v_mu:
702 ID = Intrinsic::riscv_vfcvt_rtz_x_f_v_mask;
703 PolicyAttrs = 1;
704 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
705 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
706 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
707 break;
708case RISCVVector::BI__builtin_rvv_vfcvt_rtz_xu_f_v_tu:
709 ID = Intrinsic::riscv_vfcvt_rtz_xu_f_v;
710 PolicyAttrs = 2;
711 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
712 break;
713case RISCVVector::BI__builtin_rvv_vfcvt_rtz_xu_f_v_ta:
714 ID = Intrinsic::riscv_vfcvt_rtz_xu_f_v;
715 PolicyAttrs = 3;
716 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
717 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
718 break;
719case RISCVVector::BI__builtin_rvv_vfcvt_rtz_xu_f_v_tum:
720 ID = Intrinsic::riscv_vfcvt_rtz_xu_f_v_mask;
721 PolicyAttrs = 2;
722 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
723 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
724 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
725 break;
726case RISCVVector::BI__builtin_rvv_vfcvt_rtz_xu_f_v_tama:
727 ID = Intrinsic::riscv_vfcvt_rtz_xu_f_v_mask;
728 PolicyAttrs = 3;
729 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
730 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
731 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
732 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
733 break;
734case RISCVVector::BI__builtin_rvv_vfcvt_rtz_xu_f_v_tumu:
735 ID = Intrinsic::riscv_vfcvt_rtz_xu_f_v_mask;
736 PolicyAttrs = 0;
737 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
738 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
739 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
740 break;
741case RISCVVector::BI__builtin_rvv_vfcvt_rtz_xu_f_v_mu:
742 ID = Intrinsic::riscv_vfcvt_rtz_xu_f_v_mask;
743 PolicyAttrs = 1;
744 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
745 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
746 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
747 break;
748case RISCVVector::BI__builtin_rvv_vfcvt_x_f_v_tu:
749 ID = Intrinsic::riscv_vfcvt_x_f_v;
750 PolicyAttrs = 2;
751 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
752 break;
753case RISCVVector::BI__builtin_rvv_vfcvt_x_f_v_ta:
754 ID = Intrinsic::riscv_vfcvt_x_f_v;
755 PolicyAttrs = 3;
756 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
757 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
758 break;
759case RISCVVector::BI__builtin_rvv_vfcvt_x_f_v_tum:
760 ID = Intrinsic::riscv_vfcvt_x_f_v_mask;
761 PolicyAttrs = 2;
762 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
763 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
764 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
765 break;
766case RISCVVector::BI__builtin_rvv_vfcvt_x_f_v_tama:
767 ID = Intrinsic::riscv_vfcvt_x_f_v_mask;
768 PolicyAttrs = 3;
769 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
770 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
771 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
772 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
773 break;
774case RISCVVector::BI__builtin_rvv_vfcvt_x_f_v_tumu:
775 ID = Intrinsic::riscv_vfcvt_x_f_v_mask;
776 PolicyAttrs = 0;
777 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
778 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
779 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
780 break;
781case RISCVVector::BI__builtin_rvv_vfcvt_x_f_v_mu:
782 ID = Intrinsic::riscv_vfcvt_x_f_v_mask;
783 PolicyAttrs = 1;
784 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
785 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
786 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
787 break;
788case RISCVVector::BI__builtin_rvv_vfcvt_xu_f_v_tu:
789 ID = Intrinsic::riscv_vfcvt_xu_f_v;
790 PolicyAttrs = 2;
791 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
792 break;
793case RISCVVector::BI__builtin_rvv_vfcvt_xu_f_v_ta:
794 ID = Intrinsic::riscv_vfcvt_xu_f_v;
795 PolicyAttrs = 3;
796 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
797 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
798 break;
799case RISCVVector::BI__builtin_rvv_vfcvt_xu_f_v_tum:
800 ID = Intrinsic::riscv_vfcvt_xu_f_v_mask;
801 PolicyAttrs = 2;
802 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
803 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
804 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
805 break;
806case RISCVVector::BI__builtin_rvv_vfcvt_xu_f_v_tama:
807 ID = Intrinsic::riscv_vfcvt_xu_f_v_mask;
808 PolicyAttrs = 3;
809 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
810 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
811 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
812 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
813 break;
814case RISCVVector::BI__builtin_rvv_vfcvt_xu_f_v_tumu:
815 ID = Intrinsic::riscv_vfcvt_xu_f_v_mask;
816 PolicyAttrs = 0;
817 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
818 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
819 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
820 break;
821case RISCVVector::BI__builtin_rvv_vfcvt_xu_f_v_mu:
822 ID = Intrinsic::riscv_vfcvt_xu_f_v_mask;
823 PolicyAttrs = 1;
824 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
825 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
826 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
827 break;
828case RISCVVector::BI__builtin_rvv_vfdiv_vv_tu:
829case RISCVVector::BI__builtin_rvv_vfdiv_vf_tu:
830 ID = Intrinsic::riscv_vfdiv;
831 PolicyAttrs = 2;
832 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
833 break;
834case RISCVVector::BI__builtin_rvv_vfdiv_vv_ta:
835case RISCVVector::BI__builtin_rvv_vfdiv_vf_ta:
836 ID = Intrinsic::riscv_vfdiv;
837 PolicyAttrs = 3;
838 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
839 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
840 break;
841case RISCVVector::BI__builtin_rvv_vfdiv_vv_tum:
842case RISCVVector::BI__builtin_rvv_vfdiv_vf_tum:
843 ID = Intrinsic::riscv_vfdiv_mask;
844 PolicyAttrs = 2;
845 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
846 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
847 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
848 break;
849case RISCVVector::BI__builtin_rvv_vfdiv_vv_tama:
850case RISCVVector::BI__builtin_rvv_vfdiv_vf_tama:
851 ID = Intrinsic::riscv_vfdiv_mask;
852 PolicyAttrs = 3;
853 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
854 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
855 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
856 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
857 break;
858case RISCVVector::BI__builtin_rvv_vfdiv_vv_tumu:
859case RISCVVector::BI__builtin_rvv_vfdiv_vf_tumu:
860 ID = Intrinsic::riscv_vfdiv_mask;
861 PolicyAttrs = 0;
862 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
863 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
864 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
865 break;
866case RISCVVector::BI__builtin_rvv_vfdiv_vv_mu:
867case RISCVVector::BI__builtin_rvv_vfdiv_vf_mu:
868 ID = Intrinsic::riscv_vfdiv_mask;
869 PolicyAttrs = 1;
870 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
871 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
872 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
873 break;
874case RISCVVector::BI__builtin_rvv_vfirst_m:
875 ID = Intrinsic::riscv_vfirst;
876 PolicyAttrs = 3;
877 IntrinsicTypes = {Ops[0]->getType(), Ops.back()->getType()};
878 break;
879case RISCVVector::BI__builtin_rvv_vfirst_m_m:
880 ID = Intrinsic::riscv_vfirst_mask;
881 PolicyAttrs = 3;
882 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
883 IntrinsicTypes = {Ops[0]->getType(), Ops.back()->getType()};
884 break;
885case RISCVVector::BI__builtin_rvv_vfmacc_vv_tu:
886case RISCVVector::BI__builtin_rvv_vfmacc_vf_tu:
887 ID = Intrinsic::riscv_vfmacc;
888 PolicyAttrs = 2;
889 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
890 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
891 break;
892case RISCVVector::BI__builtin_rvv_vfmacc_vv_ta:
893case RISCVVector::BI__builtin_rvv_vfmacc_vf_ta:
894 ID = Intrinsic::riscv_vfmacc;
895 PolicyAttrs = 3;
896 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
897 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
898 break;
899case RISCVVector::BI__builtin_rvv_vfmacc_vv_tum:
900case RISCVVector::BI__builtin_rvv_vfmacc_vf_tum:
901 ID = Intrinsic::riscv_vfmacc_mask;
902 PolicyAttrs = 2;
903 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
904 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
905 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
906 break;
907case RISCVVector::BI__builtin_rvv_vfmacc_vv_tama:
908case RISCVVector::BI__builtin_rvv_vfmacc_vf_tama:
909 ID = Intrinsic::riscv_vfmacc_mask;
910 PolicyAttrs = 3;
911 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
912 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
913 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
914 break;
915case RISCVVector::BI__builtin_rvv_vfmacc_vv_tumu:
916case RISCVVector::BI__builtin_rvv_vfmacc_vf_tumu:
917 ID = Intrinsic::riscv_vfmacc_mask;
918 PolicyAttrs = 0;
919 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
920 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
921 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
922 break;
923case RISCVVector::BI__builtin_rvv_vfmacc_vv_mu:
924case RISCVVector::BI__builtin_rvv_vfmacc_vf_mu:
925 ID = Intrinsic::riscv_vfmacc_mask;
926 PolicyAttrs = 1;
927 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
928 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
929 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
930 break;
931case RISCVVector::BI__builtin_rvv_vfmadd_vv_tu:
932case RISCVVector::BI__builtin_rvv_vfmadd_vf_tu:
933 ID = Intrinsic::riscv_vfmadd;
934 PolicyAttrs = 2;
935 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
936 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
937 break;
938case RISCVVector::BI__builtin_rvv_vfmadd_vv_ta:
939case RISCVVector::BI__builtin_rvv_vfmadd_vf_ta:
940 ID = Intrinsic::riscv_vfmadd;
941 PolicyAttrs = 3;
942 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
943 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
944 break;
945case RISCVVector::BI__builtin_rvv_vfmadd_vv_tum:
946case RISCVVector::BI__builtin_rvv_vfmadd_vf_tum:
947 ID = Intrinsic::riscv_vfmadd_mask;
948 PolicyAttrs = 2;
949 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
950 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
951 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
952 break;
953case RISCVVector::BI__builtin_rvv_vfmadd_vv_tama:
954case RISCVVector::BI__builtin_rvv_vfmadd_vf_tama:
955 ID = Intrinsic::riscv_vfmadd_mask;
956 PolicyAttrs = 3;
957 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
958 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
959 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
960 break;
961case RISCVVector::BI__builtin_rvv_vfmadd_vv_tumu:
962case RISCVVector::BI__builtin_rvv_vfmadd_vf_tumu:
963 ID = Intrinsic::riscv_vfmadd_mask;
964 PolicyAttrs = 0;
965 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
966 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
967 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
968 break;
969case RISCVVector::BI__builtin_rvv_vfmadd_vv_mu:
970case RISCVVector::BI__builtin_rvv_vfmadd_vf_mu:
971 ID = Intrinsic::riscv_vfmadd_mask;
972 PolicyAttrs = 1;
973 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
974 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
975 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
976 break;
977case RISCVVector::BI__builtin_rvv_vfmax_vv_tu:
978case RISCVVector::BI__builtin_rvv_vfmax_vf_tu:
979 ID = Intrinsic::riscv_vfmax;
980 PolicyAttrs = 2;
981 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
982 break;
983case RISCVVector::BI__builtin_rvv_vfmax_vv_ta:
984case RISCVVector::BI__builtin_rvv_vfmax_vf_ta:
985 ID = Intrinsic::riscv_vfmax;
986 PolicyAttrs = 3;
987 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
988 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
989 break;
990case RISCVVector::BI__builtin_rvv_vfmax_vv_tum:
991case RISCVVector::BI__builtin_rvv_vfmax_vf_tum:
992 ID = Intrinsic::riscv_vfmax_mask;
993 PolicyAttrs = 2;
994 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
995 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
996 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
997 break;
998case RISCVVector::BI__builtin_rvv_vfmax_vv_tama:
999case RISCVVector::BI__builtin_rvv_vfmax_vf_tama:
1000 ID = Intrinsic::riscv_vfmax_mask;
1001 PolicyAttrs = 3;
1002 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1003 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1004 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1005 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1006 break;
1007case RISCVVector::BI__builtin_rvv_vfmax_vv_tumu:
1008case RISCVVector::BI__builtin_rvv_vfmax_vf_tumu:
1009 ID = Intrinsic::riscv_vfmax_mask;
1010 PolicyAttrs = 0;
1011 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1012 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1013 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1014 break;
1015case RISCVVector::BI__builtin_rvv_vfmax_vv_mu:
1016case RISCVVector::BI__builtin_rvv_vfmax_vf_mu:
1017 ID = Intrinsic::riscv_vfmax_mask;
1018 PolicyAttrs = 1;
1019 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1020 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1021 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1022 break;
1023case RISCVVector::BI__builtin_rvv_vfmerge_vfm_tu:
1024 ID = Intrinsic::riscv_vfmerge;
1025 PolicyAttrs = 2;
1026IsMasked = false;
1027
1028 // insert poison passthru
1029 if (PolicyAttrs & RVV_VTA)
1030 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1031 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1032 break;
1033case RISCVVector::BI__builtin_rvv_vfmerge_vfm_ta:
1034 ID = Intrinsic::riscv_vfmerge;
1035 PolicyAttrs = 3;
1036IsMasked = false;
1037
1038 // insert poison passthru
1039 if (PolicyAttrs & RVV_VTA)
1040 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1041 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1042 break;
1043case RISCVVector::BI__builtin_rvv_vfmin_vv_tu:
1044case RISCVVector::BI__builtin_rvv_vfmin_vf_tu:
1045 ID = Intrinsic::riscv_vfmin;
1046 PolicyAttrs = 2;
1047 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1048 break;
1049case RISCVVector::BI__builtin_rvv_vfmin_vv_ta:
1050case RISCVVector::BI__builtin_rvv_vfmin_vf_ta:
1051 ID = Intrinsic::riscv_vfmin;
1052 PolicyAttrs = 3;
1053 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1054 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1055 break;
1056case RISCVVector::BI__builtin_rvv_vfmin_vv_tum:
1057case RISCVVector::BI__builtin_rvv_vfmin_vf_tum:
1058 ID = Intrinsic::riscv_vfmin_mask;
1059 PolicyAttrs = 2;
1060 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1061 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1062 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1063 break;
1064case RISCVVector::BI__builtin_rvv_vfmin_vv_tama:
1065case RISCVVector::BI__builtin_rvv_vfmin_vf_tama:
1066 ID = Intrinsic::riscv_vfmin_mask;
1067 PolicyAttrs = 3;
1068 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1069 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1070 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1071 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1072 break;
1073case RISCVVector::BI__builtin_rvv_vfmin_vv_tumu:
1074case RISCVVector::BI__builtin_rvv_vfmin_vf_tumu:
1075 ID = Intrinsic::riscv_vfmin_mask;
1076 PolicyAttrs = 0;
1077 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1078 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1079 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1080 break;
1081case RISCVVector::BI__builtin_rvv_vfmin_vv_mu:
1082case RISCVVector::BI__builtin_rvv_vfmin_vf_mu:
1083 ID = Intrinsic::riscv_vfmin_mask;
1084 PolicyAttrs = 1;
1085 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1086 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1087 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1088 break;
1089case RISCVVector::BI__builtin_rvv_vfmsac_vv_tu:
1090case RISCVVector::BI__builtin_rvv_vfmsac_vf_tu:
1091 ID = Intrinsic::riscv_vfmsac;
1092 PolicyAttrs = 2;
1093 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1094 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1095 break;
1096case RISCVVector::BI__builtin_rvv_vfmsac_vv_ta:
1097case RISCVVector::BI__builtin_rvv_vfmsac_vf_ta:
1098 ID = Intrinsic::riscv_vfmsac;
1099 PolicyAttrs = 3;
1100 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1101 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1102 break;
1103case RISCVVector::BI__builtin_rvv_vfmsac_vv_tum:
1104case RISCVVector::BI__builtin_rvv_vfmsac_vf_tum:
1105 ID = Intrinsic::riscv_vfmsac_mask;
1106 PolicyAttrs = 2;
1107 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1108 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1109 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1110 break;
1111case RISCVVector::BI__builtin_rvv_vfmsac_vv_tama:
1112case RISCVVector::BI__builtin_rvv_vfmsac_vf_tama:
1113 ID = Intrinsic::riscv_vfmsac_mask;
1114 PolicyAttrs = 3;
1115 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1116 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1117 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1118 break;
1119case RISCVVector::BI__builtin_rvv_vfmsac_vv_tumu:
1120case RISCVVector::BI__builtin_rvv_vfmsac_vf_tumu:
1121 ID = Intrinsic::riscv_vfmsac_mask;
1122 PolicyAttrs = 0;
1123 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1124 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1125 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1126 break;
1127case RISCVVector::BI__builtin_rvv_vfmsac_vv_mu:
1128case RISCVVector::BI__builtin_rvv_vfmsac_vf_mu:
1129 ID = Intrinsic::riscv_vfmsac_mask;
1130 PolicyAttrs = 1;
1131 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1132 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1133 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1134 break;
1135case RISCVVector::BI__builtin_rvv_vfmsub_vv_tu:
1136case RISCVVector::BI__builtin_rvv_vfmsub_vf_tu:
1137 ID = Intrinsic::riscv_vfmsub;
1138 PolicyAttrs = 2;
1139 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1140 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1141 break;
1142case RISCVVector::BI__builtin_rvv_vfmsub_vv_ta:
1143case RISCVVector::BI__builtin_rvv_vfmsub_vf_ta:
1144 ID = Intrinsic::riscv_vfmsub;
1145 PolicyAttrs = 3;
1146 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1147 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1148 break;
1149case RISCVVector::BI__builtin_rvv_vfmsub_vv_tum:
1150case RISCVVector::BI__builtin_rvv_vfmsub_vf_tum:
1151 ID = Intrinsic::riscv_vfmsub_mask;
1152 PolicyAttrs = 2;
1153 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1154 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1155 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1156 break;
1157case RISCVVector::BI__builtin_rvv_vfmsub_vv_tama:
1158case RISCVVector::BI__builtin_rvv_vfmsub_vf_tama:
1159 ID = Intrinsic::riscv_vfmsub_mask;
1160 PolicyAttrs = 3;
1161 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1162 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1163 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1164 break;
1165case RISCVVector::BI__builtin_rvv_vfmsub_vv_tumu:
1166case RISCVVector::BI__builtin_rvv_vfmsub_vf_tumu:
1167 ID = Intrinsic::riscv_vfmsub_mask;
1168 PolicyAttrs = 0;
1169 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1170 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1171 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1172 break;
1173case RISCVVector::BI__builtin_rvv_vfmsub_vv_mu:
1174case RISCVVector::BI__builtin_rvv_vfmsub_vf_mu:
1175 ID = Intrinsic::riscv_vfmsub_mask;
1176 PolicyAttrs = 1;
1177 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1178 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1179 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1180 break;
1181case RISCVVector::BI__builtin_rvv_vfmul_vv_tu:
1182case RISCVVector::BI__builtin_rvv_vfmul_vf_tu:
1183 ID = Intrinsic::riscv_vfmul;
1184 PolicyAttrs = 2;
1185 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1186 break;
1187case RISCVVector::BI__builtin_rvv_vfmul_vv_ta:
1188case RISCVVector::BI__builtin_rvv_vfmul_vf_ta:
1189 ID = Intrinsic::riscv_vfmul;
1190 PolicyAttrs = 3;
1191 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1192 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1193 break;
1194case RISCVVector::BI__builtin_rvv_vfmul_vv_tum:
1195case RISCVVector::BI__builtin_rvv_vfmul_vf_tum:
1196 ID = Intrinsic::riscv_vfmul_mask;
1197 PolicyAttrs = 2;
1198 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1199 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1200 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1201 break;
1202case RISCVVector::BI__builtin_rvv_vfmul_vv_tama:
1203case RISCVVector::BI__builtin_rvv_vfmul_vf_tama:
1204 ID = Intrinsic::riscv_vfmul_mask;
1205 PolicyAttrs = 3;
1206 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1207 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1208 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1209 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1210 break;
1211case RISCVVector::BI__builtin_rvv_vfmul_vv_tumu:
1212case RISCVVector::BI__builtin_rvv_vfmul_vf_tumu:
1213 ID = Intrinsic::riscv_vfmul_mask;
1214 PolicyAttrs = 0;
1215 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1216 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1217 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1218 break;
1219case RISCVVector::BI__builtin_rvv_vfmul_vv_mu:
1220case RISCVVector::BI__builtin_rvv_vfmul_vf_mu:
1221 ID = Intrinsic::riscv_vfmul_mask;
1222 PolicyAttrs = 1;
1223 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1224 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1225 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1226 break;
1227case RISCVVector::BI__builtin_rvv_vfmv_f_s:
1228 ID = Intrinsic::riscv_vfmv_f_s;
1229 PolicyAttrs = 3;
1230 IntrinsicTypes = {Ops[0]->getType()};
1231 break;
1232case RISCVVector::BI__builtin_rvv_vfmv_s_f_tu:
1233case RISCVVector::BI__builtin_rvv_vfmv_s_x_tu:
1234 ID = Intrinsic::riscv_vfmv_s_f;
1235 PolicyAttrs = 2;
1236 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1237 break;
1238case RISCVVector::BI__builtin_rvv_vfmv_s_f_ta:
1239case RISCVVector::BI__builtin_rvv_vfmv_s_x_ta:
1240 ID = Intrinsic::riscv_vfmv_s_f;
1241 PolicyAttrs = 3;
1242 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1243 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1244 break;
1245case RISCVVector::BI__builtin_rvv_vfmv_v_f_tu:
1246 ID = Intrinsic::riscv_vfmv_v_f;
1247 PolicyAttrs = 2;
1248 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1249 break;
1250case RISCVVector::BI__builtin_rvv_vfmv_v_f_ta:
1251 ID = Intrinsic::riscv_vfmv_v_f;
1252 PolicyAttrs = 3;
1253 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1254 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1255 break;
1256case RISCVVector::BI__builtin_rvv_vfncvt_f_f_w_tu:
1257 ID = Intrinsic::riscv_vfncvt_f_f_w;
1258 PolicyAttrs = 2;
1259 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1260 break;
1261case RISCVVector::BI__builtin_rvv_vfncvt_f_f_w_ta:
1262 ID = Intrinsic::riscv_vfncvt_f_f_w;
1263 PolicyAttrs = 3;
1264 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1265 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1266 break;
1267case RISCVVector::BI__builtin_rvv_vfncvt_f_f_w_tum:
1268 ID = Intrinsic::riscv_vfncvt_f_f_w_mask;
1269 PolicyAttrs = 2;
1270 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1271 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1272 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1273 break;
1274case RISCVVector::BI__builtin_rvv_vfncvt_f_f_w_tama:
1275 ID = Intrinsic::riscv_vfncvt_f_f_w_mask;
1276 PolicyAttrs = 3;
1277 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1278 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1279 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1280 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1281 break;
1282case RISCVVector::BI__builtin_rvv_vfncvt_f_f_w_tumu:
1283 ID = Intrinsic::riscv_vfncvt_f_f_w_mask;
1284 PolicyAttrs = 0;
1285 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1286 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1287 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1288 break;
1289case RISCVVector::BI__builtin_rvv_vfncvt_f_f_w_mu:
1290 ID = Intrinsic::riscv_vfncvt_f_f_w_mask;
1291 PolicyAttrs = 1;
1292 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1293 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1294 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1295 break;
1296case RISCVVector::BI__builtin_rvv_vfncvt_f_x_w_tu:
1297 ID = Intrinsic::riscv_vfncvt_f_x_w;
1298 PolicyAttrs = 2;
1299 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1300 break;
1301case RISCVVector::BI__builtin_rvv_vfncvt_f_x_w_ta:
1302 ID = Intrinsic::riscv_vfncvt_f_x_w;
1303 PolicyAttrs = 3;
1304 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1305 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1306 break;
1307case RISCVVector::BI__builtin_rvv_vfncvt_f_x_w_tum:
1308 ID = Intrinsic::riscv_vfncvt_f_x_w_mask;
1309 PolicyAttrs = 2;
1310 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1311 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1312 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1313 break;
1314case RISCVVector::BI__builtin_rvv_vfncvt_f_x_w_tama:
1315 ID = Intrinsic::riscv_vfncvt_f_x_w_mask;
1316 PolicyAttrs = 3;
1317 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1318 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1319 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1320 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1321 break;
1322case RISCVVector::BI__builtin_rvv_vfncvt_f_x_w_tumu:
1323 ID = Intrinsic::riscv_vfncvt_f_x_w_mask;
1324 PolicyAttrs = 0;
1325 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1326 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1327 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1328 break;
1329case RISCVVector::BI__builtin_rvv_vfncvt_f_x_w_mu:
1330 ID = Intrinsic::riscv_vfncvt_f_x_w_mask;
1331 PolicyAttrs = 1;
1332 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1333 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1334 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1335 break;
1336case RISCVVector::BI__builtin_rvv_vfncvt_f_xu_w_tu:
1337 ID = Intrinsic::riscv_vfncvt_f_xu_w;
1338 PolicyAttrs = 2;
1339 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1340 break;
1341case RISCVVector::BI__builtin_rvv_vfncvt_f_xu_w_ta:
1342 ID = Intrinsic::riscv_vfncvt_f_xu_w;
1343 PolicyAttrs = 3;
1344 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1345 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1346 break;
1347case RISCVVector::BI__builtin_rvv_vfncvt_f_xu_w_tum:
1348 ID = Intrinsic::riscv_vfncvt_f_xu_w_mask;
1349 PolicyAttrs = 2;
1350 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1351 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1352 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1353 break;
1354case RISCVVector::BI__builtin_rvv_vfncvt_f_xu_w_tama:
1355 ID = Intrinsic::riscv_vfncvt_f_xu_w_mask;
1356 PolicyAttrs = 3;
1357 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1358 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1359 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1360 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1361 break;
1362case RISCVVector::BI__builtin_rvv_vfncvt_f_xu_w_tumu:
1363 ID = Intrinsic::riscv_vfncvt_f_xu_w_mask;
1364 PolicyAttrs = 0;
1365 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1366 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1367 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1368 break;
1369case RISCVVector::BI__builtin_rvv_vfncvt_f_xu_w_mu:
1370 ID = Intrinsic::riscv_vfncvt_f_xu_w_mask;
1371 PolicyAttrs = 1;
1372 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1373 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1374 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1375 break;
1376case RISCVVector::BI__builtin_rvv_vfncvt_rod_f_f_w_tu:
1377 ID = Intrinsic::riscv_vfncvt_rod_f_f_w;
1378 PolicyAttrs = 2;
1379 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1380 break;
1381case RISCVVector::BI__builtin_rvv_vfncvt_rod_f_f_w_ta:
1382 ID = Intrinsic::riscv_vfncvt_rod_f_f_w;
1383 PolicyAttrs = 3;
1384 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1385 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1386 break;
1387case RISCVVector::BI__builtin_rvv_vfncvt_rod_f_f_w_tum:
1388 ID = Intrinsic::riscv_vfncvt_rod_f_f_w_mask;
1389 PolicyAttrs = 2;
1390 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1391 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1392 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1393 break;
1394case RISCVVector::BI__builtin_rvv_vfncvt_rod_f_f_w_tama:
1395 ID = Intrinsic::riscv_vfncvt_rod_f_f_w_mask;
1396 PolicyAttrs = 3;
1397 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1398 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1399 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1400 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1401 break;
1402case RISCVVector::BI__builtin_rvv_vfncvt_rod_f_f_w_tumu:
1403 ID = Intrinsic::riscv_vfncvt_rod_f_f_w_mask;
1404 PolicyAttrs = 0;
1405 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1406 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1407 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1408 break;
1409case RISCVVector::BI__builtin_rvv_vfncvt_rod_f_f_w_mu:
1410 ID = Intrinsic::riscv_vfncvt_rod_f_f_w_mask;
1411 PolicyAttrs = 1;
1412 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1413 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1414 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1415 break;
1416case RISCVVector::BI__builtin_rvv_vfncvt_rtz_x_f_w_tu:
1417 ID = Intrinsic::riscv_vfncvt_rtz_x_f_w;
1418 PolicyAttrs = 2;
1419 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1420 break;
1421case RISCVVector::BI__builtin_rvv_vfncvt_rtz_x_f_w_ta:
1422 ID = Intrinsic::riscv_vfncvt_rtz_x_f_w;
1423 PolicyAttrs = 3;
1424 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1425 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1426 break;
1427case RISCVVector::BI__builtin_rvv_vfncvt_rtz_x_f_w_tum:
1428 ID = Intrinsic::riscv_vfncvt_rtz_x_f_w_mask;
1429 PolicyAttrs = 2;
1430 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1431 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1432 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1433 break;
1434case RISCVVector::BI__builtin_rvv_vfncvt_rtz_x_f_w_tama:
1435 ID = Intrinsic::riscv_vfncvt_rtz_x_f_w_mask;
1436 PolicyAttrs = 3;
1437 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1438 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1439 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1440 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1441 break;
1442case RISCVVector::BI__builtin_rvv_vfncvt_rtz_x_f_w_tumu:
1443 ID = Intrinsic::riscv_vfncvt_rtz_x_f_w_mask;
1444 PolicyAttrs = 0;
1445 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1446 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1447 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1448 break;
1449case RISCVVector::BI__builtin_rvv_vfncvt_rtz_x_f_w_mu:
1450 ID = Intrinsic::riscv_vfncvt_rtz_x_f_w_mask;
1451 PolicyAttrs = 1;
1452 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1453 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1454 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1455 break;
1456case RISCVVector::BI__builtin_rvv_vfncvt_rtz_xu_f_w_tu:
1457 ID = Intrinsic::riscv_vfncvt_rtz_xu_f_w;
1458 PolicyAttrs = 2;
1459 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1460 break;
1461case RISCVVector::BI__builtin_rvv_vfncvt_rtz_xu_f_w_ta:
1462 ID = Intrinsic::riscv_vfncvt_rtz_xu_f_w;
1463 PolicyAttrs = 3;
1464 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1465 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1466 break;
1467case RISCVVector::BI__builtin_rvv_vfncvt_rtz_xu_f_w_tum:
1468 ID = Intrinsic::riscv_vfncvt_rtz_xu_f_w_mask;
1469 PolicyAttrs = 2;
1470 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1471 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1472 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1473 break;
1474case RISCVVector::BI__builtin_rvv_vfncvt_rtz_xu_f_w_tama:
1475 ID = Intrinsic::riscv_vfncvt_rtz_xu_f_w_mask;
1476 PolicyAttrs = 3;
1477 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1478 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1479 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1480 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1481 break;
1482case RISCVVector::BI__builtin_rvv_vfncvt_rtz_xu_f_w_tumu:
1483 ID = Intrinsic::riscv_vfncvt_rtz_xu_f_w_mask;
1484 PolicyAttrs = 0;
1485 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1486 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1487 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1488 break;
1489case RISCVVector::BI__builtin_rvv_vfncvt_rtz_xu_f_w_mu:
1490 ID = Intrinsic::riscv_vfncvt_rtz_xu_f_w_mask;
1491 PolicyAttrs = 1;
1492 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1493 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1494 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1495 break;
1496case RISCVVector::BI__builtin_rvv_vfncvt_x_f_w_tu:
1497 ID = Intrinsic::riscv_vfncvt_x_f_w;
1498 PolicyAttrs = 2;
1499 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1500 break;
1501case RISCVVector::BI__builtin_rvv_vfncvt_x_f_w_ta:
1502 ID = Intrinsic::riscv_vfncvt_x_f_w;
1503 PolicyAttrs = 3;
1504 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1505 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1506 break;
1507case RISCVVector::BI__builtin_rvv_vfncvt_x_f_w_tum:
1508 ID = Intrinsic::riscv_vfncvt_x_f_w_mask;
1509 PolicyAttrs = 2;
1510 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1511 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1512 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1513 break;
1514case RISCVVector::BI__builtin_rvv_vfncvt_x_f_w_tama:
1515 ID = Intrinsic::riscv_vfncvt_x_f_w_mask;
1516 PolicyAttrs = 3;
1517 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1518 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1519 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1520 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1521 break;
1522case RISCVVector::BI__builtin_rvv_vfncvt_x_f_w_tumu:
1523 ID = Intrinsic::riscv_vfncvt_x_f_w_mask;
1524 PolicyAttrs = 0;
1525 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1526 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1527 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1528 break;
1529case RISCVVector::BI__builtin_rvv_vfncvt_x_f_w_mu:
1530 ID = Intrinsic::riscv_vfncvt_x_f_w_mask;
1531 PolicyAttrs = 1;
1532 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1533 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1534 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1535 break;
1536case RISCVVector::BI__builtin_rvv_vfncvt_xu_f_w_tu:
1537 ID = Intrinsic::riscv_vfncvt_xu_f_w;
1538 PolicyAttrs = 2;
Value stored to 'PolicyAttrs' is never read
1539 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1540 break;
1541case RISCVVector::BI__builtin_rvv_vfncvt_xu_f_w_ta:
1542 ID = Intrinsic::riscv_vfncvt_xu_f_w;
1543 PolicyAttrs = 3;
1544 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1545 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1546 break;
1547case RISCVVector::BI__builtin_rvv_vfncvt_xu_f_w_tum:
1548 ID = Intrinsic::riscv_vfncvt_xu_f_w_mask;
1549 PolicyAttrs = 2;
1550 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1551 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1552 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1553 break;
1554case RISCVVector::BI__builtin_rvv_vfncvt_xu_f_w_tama:
1555 ID = Intrinsic::riscv_vfncvt_xu_f_w_mask;
1556 PolicyAttrs = 3;
1557 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1558 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1559 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1560 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1561 break;
1562case RISCVVector::BI__builtin_rvv_vfncvt_xu_f_w_tumu:
1563 ID = Intrinsic::riscv_vfncvt_xu_f_w_mask;
1564 PolicyAttrs = 0;
1565 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1566 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1567 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1568 break;
1569case RISCVVector::BI__builtin_rvv_vfncvt_xu_f_w_mu:
1570 ID = Intrinsic::riscv_vfncvt_xu_f_w_mask;
1571 PolicyAttrs = 1;
1572 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1573 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1574 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1575 break;
1576case RISCVVector::BI__builtin_rvv_vfnmacc_vv_tu:
1577case RISCVVector::BI__builtin_rvv_vfnmacc_vf_tu:
1578 ID = Intrinsic::riscv_vfnmacc;
1579 PolicyAttrs = 2;
1580 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1581 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1582 break;
1583case RISCVVector::BI__builtin_rvv_vfnmacc_vv_ta:
1584case RISCVVector::BI__builtin_rvv_vfnmacc_vf_ta:
1585 ID = Intrinsic::riscv_vfnmacc;
1586 PolicyAttrs = 3;
1587 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1588 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1589 break;
1590case RISCVVector::BI__builtin_rvv_vfnmacc_vv_tum:
1591case RISCVVector::BI__builtin_rvv_vfnmacc_vf_tum:
1592 ID = Intrinsic::riscv_vfnmacc_mask;
1593 PolicyAttrs = 2;
1594 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1595 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1596 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1597 break;
1598case RISCVVector::BI__builtin_rvv_vfnmacc_vv_tama:
1599case RISCVVector::BI__builtin_rvv_vfnmacc_vf_tama:
1600 ID = Intrinsic::riscv_vfnmacc_mask;
1601 PolicyAttrs = 3;
1602 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1603 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1604 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1605 break;
1606case RISCVVector::BI__builtin_rvv_vfnmacc_vv_tumu:
1607case RISCVVector::BI__builtin_rvv_vfnmacc_vf_tumu:
1608 ID = Intrinsic::riscv_vfnmacc_mask;
1609 PolicyAttrs = 0;
1610 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1611 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1612 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1613 break;
1614case RISCVVector::BI__builtin_rvv_vfnmacc_vv_mu:
1615case RISCVVector::BI__builtin_rvv_vfnmacc_vf_mu:
1616 ID = Intrinsic::riscv_vfnmacc_mask;
1617 PolicyAttrs = 1;
1618 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1619 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1620 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1621 break;
1622case RISCVVector::BI__builtin_rvv_vfnmadd_vv_tu:
1623case RISCVVector::BI__builtin_rvv_vfnmadd_vf_tu:
1624 ID = Intrinsic::riscv_vfnmadd;
1625 PolicyAttrs = 2;
1626 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1627 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1628 break;
1629case RISCVVector::BI__builtin_rvv_vfnmadd_vv_ta:
1630case RISCVVector::BI__builtin_rvv_vfnmadd_vf_ta:
1631 ID = Intrinsic::riscv_vfnmadd;
1632 PolicyAttrs = 3;
1633 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1634 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1635 break;
1636case RISCVVector::BI__builtin_rvv_vfnmadd_vv_tum:
1637case RISCVVector::BI__builtin_rvv_vfnmadd_vf_tum:
1638 ID = Intrinsic::riscv_vfnmadd_mask;
1639 PolicyAttrs = 2;
1640 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1641 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1642 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1643 break;
1644case RISCVVector::BI__builtin_rvv_vfnmadd_vv_tama:
1645case RISCVVector::BI__builtin_rvv_vfnmadd_vf_tama:
1646 ID = Intrinsic::riscv_vfnmadd_mask;
1647 PolicyAttrs = 3;
1648 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1649 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1650 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1651 break;
1652case RISCVVector::BI__builtin_rvv_vfnmadd_vv_tumu:
1653case RISCVVector::BI__builtin_rvv_vfnmadd_vf_tumu:
1654 ID = Intrinsic::riscv_vfnmadd_mask;
1655 PolicyAttrs = 0;
1656 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1657 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1658 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1659 break;
1660case RISCVVector::BI__builtin_rvv_vfnmadd_vv_mu:
1661case RISCVVector::BI__builtin_rvv_vfnmadd_vf_mu:
1662 ID = Intrinsic::riscv_vfnmadd_mask;
1663 PolicyAttrs = 1;
1664 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1665 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1666 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1667 break;
1668case RISCVVector::BI__builtin_rvv_vfnmsac_vv_tu:
1669case RISCVVector::BI__builtin_rvv_vfnmsac_vf_tu:
1670 ID = Intrinsic::riscv_vfnmsac;
1671 PolicyAttrs = 2;
1672 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1673 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1674 break;
1675case RISCVVector::BI__builtin_rvv_vfnmsac_vv_ta:
1676case RISCVVector::BI__builtin_rvv_vfnmsac_vf_ta:
1677 ID = Intrinsic::riscv_vfnmsac;
1678 PolicyAttrs = 3;
1679 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1680 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1681 break;
1682case RISCVVector::BI__builtin_rvv_vfnmsac_vv_tum:
1683case RISCVVector::BI__builtin_rvv_vfnmsac_vf_tum:
1684 ID = Intrinsic::riscv_vfnmsac_mask;
1685 PolicyAttrs = 2;
1686 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1687 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1688 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1689 break;
1690case RISCVVector::BI__builtin_rvv_vfnmsac_vv_tama:
1691case RISCVVector::BI__builtin_rvv_vfnmsac_vf_tama:
1692 ID = Intrinsic::riscv_vfnmsac_mask;
1693 PolicyAttrs = 3;
1694 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1695 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1696 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1697 break;
1698case RISCVVector::BI__builtin_rvv_vfnmsac_vv_tumu:
1699case RISCVVector::BI__builtin_rvv_vfnmsac_vf_tumu:
1700 ID = Intrinsic::riscv_vfnmsac_mask;
1701 PolicyAttrs = 0;
1702 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1703 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1704 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1705 break;
1706case RISCVVector::BI__builtin_rvv_vfnmsac_vv_mu:
1707case RISCVVector::BI__builtin_rvv_vfnmsac_vf_mu:
1708 ID = Intrinsic::riscv_vfnmsac_mask;
1709 PolicyAttrs = 1;
1710 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1711 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1712 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1713 break;
1714case RISCVVector::BI__builtin_rvv_vfnmsub_vv_tu:
1715case RISCVVector::BI__builtin_rvv_vfnmsub_vf_tu:
1716 ID = Intrinsic::riscv_vfnmsub;
1717 PolicyAttrs = 2;
1718 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1719 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1720 break;
1721case RISCVVector::BI__builtin_rvv_vfnmsub_vv_ta:
1722case RISCVVector::BI__builtin_rvv_vfnmsub_vf_ta:
1723 ID = Intrinsic::riscv_vfnmsub;
1724 PolicyAttrs = 3;
1725 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1726 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1727 break;
1728case RISCVVector::BI__builtin_rvv_vfnmsub_vv_tum:
1729case RISCVVector::BI__builtin_rvv_vfnmsub_vf_tum:
1730 ID = Intrinsic::riscv_vfnmsub_mask;
1731 PolicyAttrs = 2;
1732 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1733 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1734 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1735 break;
1736case RISCVVector::BI__builtin_rvv_vfnmsub_vv_tama:
1737case RISCVVector::BI__builtin_rvv_vfnmsub_vf_tama:
1738 ID = Intrinsic::riscv_vfnmsub_mask;
1739 PolicyAttrs = 3;
1740 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1741 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1742 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1743 break;
1744case RISCVVector::BI__builtin_rvv_vfnmsub_vv_tumu:
1745case RISCVVector::BI__builtin_rvv_vfnmsub_vf_tumu:
1746 ID = Intrinsic::riscv_vfnmsub_mask;
1747 PolicyAttrs = 0;
1748 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1749 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1750 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1751 break;
1752case RISCVVector::BI__builtin_rvv_vfnmsub_vv_mu:
1753case RISCVVector::BI__builtin_rvv_vfnmsub_vf_mu:
1754 ID = Intrinsic::riscv_vfnmsub_mask;
1755 PolicyAttrs = 1;
1756 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1757 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1758 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1759 break;
1760case RISCVVector::BI__builtin_rvv_vfrdiv_vf_tu:
1761 ID = Intrinsic::riscv_vfrdiv;
1762 PolicyAttrs = 2;
1763 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1764 break;
1765case RISCVVector::BI__builtin_rvv_vfrdiv_vf_ta:
1766 ID = Intrinsic::riscv_vfrdiv;
1767 PolicyAttrs = 3;
1768 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1769 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1770 break;
1771case RISCVVector::BI__builtin_rvv_vfrdiv_vf_tum:
1772 ID = Intrinsic::riscv_vfrdiv_mask;
1773 PolicyAttrs = 2;
1774 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1775 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1776 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1777 break;
1778case RISCVVector::BI__builtin_rvv_vfrdiv_vf_tama:
1779 ID = Intrinsic::riscv_vfrdiv_mask;
1780 PolicyAttrs = 3;
1781 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1782 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1783 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1784 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1785 break;
1786case RISCVVector::BI__builtin_rvv_vfrdiv_vf_tumu:
1787 ID = Intrinsic::riscv_vfrdiv_mask;
1788 PolicyAttrs = 0;
1789 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1790 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1791 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1792 break;
1793case RISCVVector::BI__builtin_rvv_vfrdiv_vf_mu:
1794 ID = Intrinsic::riscv_vfrdiv_mask;
1795 PolicyAttrs = 1;
1796 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1797 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1798 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1799 break;
1800case RISCVVector::BI__builtin_rvv_vfrec7_v_tu:
1801 ID = Intrinsic::riscv_vfrec7;
1802 PolicyAttrs = 2;
1803 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1804 break;
1805case RISCVVector::BI__builtin_rvv_vfrec7_v_ta:
1806 ID = Intrinsic::riscv_vfrec7;
1807 PolicyAttrs = 3;
1808 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1809 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1810 break;
1811case RISCVVector::BI__builtin_rvv_vfrec7_v_tum:
1812 ID = Intrinsic::riscv_vfrec7_mask;
1813 PolicyAttrs = 2;
1814 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1815 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1816 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1817 break;
1818case RISCVVector::BI__builtin_rvv_vfrec7_v_tama:
1819 ID = Intrinsic::riscv_vfrec7_mask;
1820 PolicyAttrs = 3;
1821 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1822 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1823 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1824 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1825 break;
1826case RISCVVector::BI__builtin_rvv_vfrec7_v_tumu:
1827 ID = Intrinsic::riscv_vfrec7_mask;
1828 PolicyAttrs = 0;
1829 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1830 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1831 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1832 break;
1833case RISCVVector::BI__builtin_rvv_vfrec7_v_mu:
1834 ID = Intrinsic::riscv_vfrec7_mask;
1835 PolicyAttrs = 1;
1836 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1837 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1838 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1839 break;
1840case RISCVVector::BI__builtin_rvv_vfredmax_vs_tu:
1841 ID = Intrinsic::riscv_vfredmax;
1842 PolicyAttrs = 2;
1843 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1844 break;
1845case RISCVVector::BI__builtin_rvv_vfredmax_vs_ta:
1846 ID = Intrinsic::riscv_vfredmax;
1847 PolicyAttrs = 3;
1848 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1849 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1850 break;
1851case RISCVVector::BI__builtin_rvv_vfredmax_vs_tum:
1852 ID = Intrinsic::riscv_vfredmax_mask;
1853 PolicyAttrs = 2;
1854 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1855 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1856 break;
1857case RISCVVector::BI__builtin_rvv_vfredmax_vs_tama:
1858 ID = Intrinsic::riscv_vfredmax_mask;
1859 PolicyAttrs = 3;
1860 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1861 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1862 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1863 break;
1864case RISCVVector::BI__builtin_rvv_vfredmin_vs_tu:
1865 ID = Intrinsic::riscv_vfredmin;
1866 PolicyAttrs = 2;
1867 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1868 break;
1869case RISCVVector::BI__builtin_rvv_vfredmin_vs_ta:
1870 ID = Intrinsic::riscv_vfredmin;
1871 PolicyAttrs = 3;
1872 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1873 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1874 break;
1875case RISCVVector::BI__builtin_rvv_vfredmin_vs_tum:
1876 ID = Intrinsic::riscv_vfredmin_mask;
1877 PolicyAttrs = 2;
1878 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1879 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1880 break;
1881case RISCVVector::BI__builtin_rvv_vfredmin_vs_tama:
1882 ID = Intrinsic::riscv_vfredmin_mask;
1883 PolicyAttrs = 3;
1884 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1885 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1886 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1887 break;
1888case RISCVVector::BI__builtin_rvv_vfredosum_vs_tu:
1889 ID = Intrinsic::riscv_vfredosum;
1890 PolicyAttrs = 2;
1891 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1892 break;
1893case RISCVVector::BI__builtin_rvv_vfredosum_vs_ta:
1894 ID = Intrinsic::riscv_vfredosum;
1895 PolicyAttrs = 3;
1896 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1897 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1898 break;
1899case RISCVVector::BI__builtin_rvv_vfredosum_vs_tum:
1900 ID = Intrinsic::riscv_vfredosum_mask;
1901 PolicyAttrs = 2;
1902 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1903 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1904 break;
1905case RISCVVector::BI__builtin_rvv_vfredosum_vs_tama:
1906 ID = Intrinsic::riscv_vfredosum_mask;
1907 PolicyAttrs = 3;
1908 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1909 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1910 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1911 break;
1912case RISCVVector::BI__builtin_rvv_vfredusum_vs_tu:
1913 ID = Intrinsic::riscv_vfredusum;
1914 PolicyAttrs = 2;
1915 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1916 break;
1917case RISCVVector::BI__builtin_rvv_vfredusum_vs_ta:
1918 ID = Intrinsic::riscv_vfredusum;
1919 PolicyAttrs = 3;
1920 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1921 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1922 break;
1923case RISCVVector::BI__builtin_rvv_vfredusum_vs_tum:
1924 ID = Intrinsic::riscv_vfredusum_mask;
1925 PolicyAttrs = 2;
1926 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1927 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1928 break;
1929case RISCVVector::BI__builtin_rvv_vfredusum_vs_tama:
1930 ID = Intrinsic::riscv_vfredusum_mask;
1931 PolicyAttrs = 3;
1932 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1933 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1934 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
1935 break;
1936case RISCVVector::BI__builtin_rvv_vfrsqrt7_v_tu:
1937 ID = Intrinsic::riscv_vfrsqrt7;
1938 PolicyAttrs = 2;
1939 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1940 break;
1941case RISCVVector::BI__builtin_rvv_vfrsqrt7_v_ta:
1942 ID = Intrinsic::riscv_vfrsqrt7;
1943 PolicyAttrs = 3;
1944 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1945 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1946 break;
1947case RISCVVector::BI__builtin_rvv_vfrsqrt7_v_tum:
1948 ID = Intrinsic::riscv_vfrsqrt7_mask;
1949 PolicyAttrs = 2;
1950 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1951 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1952 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1953 break;
1954case RISCVVector::BI__builtin_rvv_vfrsqrt7_v_tama:
1955 ID = Intrinsic::riscv_vfrsqrt7_mask;
1956 PolicyAttrs = 3;
1957 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1958 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1959 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1960 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1961 break;
1962case RISCVVector::BI__builtin_rvv_vfrsqrt7_v_tumu:
1963 ID = Intrinsic::riscv_vfrsqrt7_mask;
1964 PolicyAttrs = 0;
1965 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1966 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1967 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1968 break;
1969case RISCVVector::BI__builtin_rvv_vfrsqrt7_v_mu:
1970 ID = Intrinsic::riscv_vfrsqrt7_mask;
1971 PolicyAttrs = 1;
1972 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1973 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1974 IntrinsicTypes = {ResultType, Ops.back()->getType()};
1975 break;
1976case RISCVVector::BI__builtin_rvv_vfrsub_vf_tu:
1977 ID = Intrinsic::riscv_vfrsub;
1978 PolicyAttrs = 2;
1979 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1980 break;
1981case RISCVVector::BI__builtin_rvv_vfrsub_vf_ta:
1982 ID = Intrinsic::riscv_vfrsub;
1983 PolicyAttrs = 3;
1984 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
1985 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1986 break;
1987case RISCVVector::BI__builtin_rvv_vfrsub_vf_tum:
1988 ID = Intrinsic::riscv_vfrsub_mask;
1989 PolicyAttrs = 2;
1990 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1991 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1992 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
1993 break;
1994case RISCVVector::BI__builtin_rvv_vfrsub_vf_tama:
1995 ID = Intrinsic::riscv_vfrsub_mask;
1996 PolicyAttrs = 3;
1997 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
1998 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
1999 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2000 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2001 break;
2002case RISCVVector::BI__builtin_rvv_vfrsub_vf_tumu:
2003 ID = Intrinsic::riscv_vfrsub_mask;
2004 PolicyAttrs = 0;
2005 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2006 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2007 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2008 break;
2009case RISCVVector::BI__builtin_rvv_vfrsub_vf_mu:
2010 ID = Intrinsic::riscv_vfrsub_mask;
2011 PolicyAttrs = 1;
2012 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2013 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2014 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2015 break;
2016case RISCVVector::BI__builtin_rvv_vfsgnj_vv_tu:
2017case RISCVVector::BI__builtin_rvv_vfsgnj_vf_tu:
2018 ID = Intrinsic::riscv_vfsgnj;
2019 PolicyAttrs = 2;
2020 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2021 break;
2022case RISCVVector::BI__builtin_rvv_vfsgnj_vv_ta:
2023case RISCVVector::BI__builtin_rvv_vfsgnj_vf_ta:
2024 ID = Intrinsic::riscv_vfsgnj;
2025 PolicyAttrs = 3;
2026 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2027 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2028 break;
2029case RISCVVector::BI__builtin_rvv_vfsgnj_vv_tum:
2030case RISCVVector::BI__builtin_rvv_vfsgnj_vf_tum:
2031 ID = Intrinsic::riscv_vfsgnj_mask;
2032 PolicyAttrs = 2;
2033 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2034 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2035 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2036 break;
2037case RISCVVector::BI__builtin_rvv_vfsgnj_vv_tama:
2038case RISCVVector::BI__builtin_rvv_vfsgnj_vf_tama:
2039 ID = Intrinsic::riscv_vfsgnj_mask;
2040 PolicyAttrs = 3;
2041 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2042 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2043 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2044 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2045 break;
2046case RISCVVector::BI__builtin_rvv_vfsgnj_vv_tumu:
2047case RISCVVector::BI__builtin_rvv_vfsgnj_vf_tumu:
2048 ID = Intrinsic::riscv_vfsgnj_mask;
2049 PolicyAttrs = 0;
2050 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2051 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2052 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2053 break;
2054case RISCVVector::BI__builtin_rvv_vfsgnj_vv_mu:
2055case RISCVVector::BI__builtin_rvv_vfsgnj_vf_mu:
2056 ID = Intrinsic::riscv_vfsgnj_mask;
2057 PolicyAttrs = 1;
2058 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2059 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2060 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2061 break;
2062case RISCVVector::BI__builtin_rvv_vfsgnjn_vv_tu:
2063case RISCVVector::BI__builtin_rvv_vfsgnjn_vf_tu:
2064 ID = Intrinsic::riscv_vfsgnjn;
2065 PolicyAttrs = 2;
2066 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2067 break;
2068case RISCVVector::BI__builtin_rvv_vfneg_v_tu:
2069 ID = Intrinsic::riscv_vfsgnjn;
2070 PolicyAttrs = 2;
2071IsMasked = false;
2072
2073 {
2074 if (IsMasked) {
2075 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2076 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
2077 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2078 Ops.insert(Ops.begin() + 2, Ops[1]);
2079 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2080 // maskedoff, op1, op2, mask, vl
2081 IntrinsicTypes = {ResultType,
2082 Ops[2]->getType(),
2083 Ops.back()->getType()};
2084 } else {
2085 if (PolicyAttrs & RVV_VTA)
2086 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2087 // op1, po2, vl
2088 IntrinsicTypes = {ResultType,
2089 Ops[1]->getType(), Ops[2]->getType()};
2090 Ops.insert(Ops.begin() + 2, Ops[1]);
2091 break;
2092 }
2093 break;
2094 }
2095 break;
2096case RISCVVector::BI__builtin_rvv_vfsgnjn_vv_ta:
2097case RISCVVector::BI__builtin_rvv_vfsgnjn_vf_ta:
2098 ID = Intrinsic::riscv_vfsgnjn;
2099 PolicyAttrs = 3;
2100 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2101 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2102 break;
2103case RISCVVector::BI__builtin_rvv_vfneg_v_ta:
2104 ID = Intrinsic::riscv_vfsgnjn;
2105 PolicyAttrs = 3;
2106IsMasked = false;
2107
2108 {
2109 if (IsMasked) {
2110 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2111 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
2112 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2113 Ops.insert(Ops.begin() + 2, Ops[1]);
2114 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2115 // maskedoff, op1, op2, mask, vl
2116 IntrinsicTypes = {ResultType,
2117 Ops[2]->getType(),
2118 Ops.back()->getType()};
2119 } else {
2120 if (PolicyAttrs & RVV_VTA)
2121 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2122 // op1, po2, vl
2123 IntrinsicTypes = {ResultType,
2124 Ops[1]->getType(), Ops[2]->getType()};
2125 Ops.insert(Ops.begin() + 2, Ops[1]);
2126 break;
2127 }
2128 break;
2129 }
2130 break;
2131case RISCVVector::BI__builtin_rvv_vfsgnjn_vv_tum:
2132case RISCVVector::BI__builtin_rvv_vfsgnjn_vf_tum:
2133 ID = Intrinsic::riscv_vfsgnjn_mask;
2134 PolicyAttrs = 2;
2135 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2136 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2137 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2138 break;
2139case RISCVVector::BI__builtin_rvv_vfneg_v_tum:
2140 ID = Intrinsic::riscv_vfsgnjn_mask;
2141 PolicyAttrs = 2;
2142IsMasked = true;
2143
2144 {
2145 if (IsMasked) {
2146 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2147 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
2148 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2149 Ops.insert(Ops.begin() + 2, Ops[1]);
2150 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2151 // maskedoff, op1, op2, mask, vl
2152 IntrinsicTypes = {ResultType,
2153 Ops[2]->getType(),
2154 Ops.back()->getType()};
2155 } else {
2156 if (PolicyAttrs & RVV_VTA)
2157 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2158 // op1, po2, vl
2159 IntrinsicTypes = {ResultType,
2160 Ops[1]->getType(), Ops[2]->getType()};
2161 Ops.insert(Ops.begin() + 2, Ops[1]);
2162 break;
2163 }
2164 break;
2165 }
2166 break;
2167case RISCVVector::BI__builtin_rvv_vfsgnjn_vv_tama:
2168case RISCVVector::BI__builtin_rvv_vfsgnjn_vf_tama:
2169 ID = Intrinsic::riscv_vfsgnjn_mask;
2170 PolicyAttrs = 3;
2171 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2172 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2173 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2174 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2175 break;
2176case RISCVVector::BI__builtin_rvv_vfneg_v_tama:
2177 ID = Intrinsic::riscv_vfsgnjn_mask;
2178 PolicyAttrs = 3;
2179IsMasked = true;
2180
2181 {
2182 if (IsMasked) {
2183 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2184 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
2185 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2186 Ops.insert(Ops.begin() + 2, Ops[1]);
2187 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2188 // maskedoff, op1, op2, mask, vl
2189 IntrinsicTypes = {ResultType,
2190 Ops[2]->getType(),
2191 Ops.back()->getType()};
2192 } else {
2193 if (PolicyAttrs & RVV_VTA)
2194 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2195 // op1, po2, vl
2196 IntrinsicTypes = {ResultType,
2197 Ops[1]->getType(), Ops[2]->getType()};
2198 Ops.insert(Ops.begin() + 2, Ops[1]);
2199 break;
2200 }
2201 break;
2202 }
2203 break;
2204case RISCVVector::BI__builtin_rvv_vfsgnjn_vv_tumu:
2205case RISCVVector::BI__builtin_rvv_vfsgnjn_vf_tumu:
2206 ID = Intrinsic::riscv_vfsgnjn_mask;
2207 PolicyAttrs = 0;
2208 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2209 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2210 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2211 break;
2212case RISCVVector::BI__builtin_rvv_vfneg_v_tumu:
2213 ID = Intrinsic::riscv_vfsgnjn_mask;
2214 PolicyAttrs = 0;
2215IsMasked = true;
2216
2217 {
2218 if (IsMasked) {
2219 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2220 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
2221 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2222 Ops.insert(Ops.begin() + 2, Ops[1]);
2223 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2224 // maskedoff, op1, op2, mask, vl
2225 IntrinsicTypes = {ResultType,
2226 Ops[2]->getType(),
2227 Ops.back()->getType()};
2228 } else {
2229 if (PolicyAttrs & RVV_VTA)
2230 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2231 // op1, po2, vl
2232 IntrinsicTypes = {ResultType,
2233 Ops[1]->getType(), Ops[2]->getType()};
2234 Ops.insert(Ops.begin() + 2, Ops[1]);
2235 break;
2236 }
2237 break;
2238 }
2239 break;
2240case RISCVVector::BI__builtin_rvv_vfsgnjn_vv_mu:
2241case RISCVVector::BI__builtin_rvv_vfsgnjn_vf_mu:
2242 ID = Intrinsic::riscv_vfsgnjn_mask;
2243 PolicyAttrs = 1;
2244 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2245 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2246 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2247 break;
2248case RISCVVector::BI__builtin_rvv_vfneg_v_mu:
2249 ID = Intrinsic::riscv_vfsgnjn_mask;
2250 PolicyAttrs = 1;
2251IsMasked = true;
2252
2253 {
2254 if (IsMasked) {
2255 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2256 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
2257 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2258 Ops.insert(Ops.begin() + 2, Ops[1]);
2259 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2260 // maskedoff, op1, op2, mask, vl
2261 IntrinsicTypes = {ResultType,
2262 Ops[2]->getType(),
2263 Ops.back()->getType()};
2264 } else {
2265 if (PolicyAttrs & RVV_VTA)
2266 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2267 // op1, po2, vl
2268 IntrinsicTypes = {ResultType,
2269 Ops[1]->getType(), Ops[2]->getType()};
2270 Ops.insert(Ops.begin() + 2, Ops[1]);
2271 break;
2272 }
2273 break;
2274 }
2275 break;
2276case RISCVVector::BI__builtin_rvv_vfsgnjx_vv_tu:
2277case RISCVVector::BI__builtin_rvv_vfsgnjx_vf_tu:
2278 ID = Intrinsic::riscv_vfsgnjx;
2279 PolicyAttrs = 2;
2280 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2281 break;
2282case RISCVVector::BI__builtin_rvv_vfabs_v_tu:
2283 ID = Intrinsic::riscv_vfsgnjx;
2284 PolicyAttrs = 2;
2285IsMasked = false;
2286
2287 {
2288 if (IsMasked) {
2289 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2290 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
2291 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2292 Ops.insert(Ops.begin() + 2, Ops[1]);
2293 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2294 // maskedoff, op1, op2, mask, vl
2295 IntrinsicTypes = {ResultType,
2296 Ops[2]->getType(),
2297 Ops.back()->getType()};
2298 } else {
2299 if (PolicyAttrs & RVV_VTA)
2300 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2301 // op1, po2, vl
2302 IntrinsicTypes = {ResultType,
2303 Ops[1]->getType(), Ops[2]->getType()};
2304 Ops.insert(Ops.begin() + 2, Ops[1]);
2305 break;
2306 }
2307 break;
2308 }
2309 break;
2310case RISCVVector::BI__builtin_rvv_vfsgnjx_vv_ta:
2311case RISCVVector::BI__builtin_rvv_vfsgnjx_vf_ta:
2312 ID = Intrinsic::riscv_vfsgnjx;
2313 PolicyAttrs = 3;
2314 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2315 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2316 break;
2317case RISCVVector::BI__builtin_rvv_vfabs_v_ta:
2318 ID = Intrinsic::riscv_vfsgnjx;
2319 PolicyAttrs = 3;
2320IsMasked = false;
2321
2322 {
2323 if (IsMasked) {
2324 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2325 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
2326 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2327 Ops.insert(Ops.begin() + 2, Ops[1]);
2328 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2329 // maskedoff, op1, op2, mask, vl
2330 IntrinsicTypes = {ResultType,
2331 Ops[2]->getType(),
2332 Ops.back()->getType()};
2333 } else {
2334 if (PolicyAttrs & RVV_VTA)
2335 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2336 // op1, po2, vl
2337 IntrinsicTypes = {ResultType,
2338 Ops[1]->getType(), Ops[2]->getType()};
2339 Ops.insert(Ops.begin() + 2, Ops[1]);
2340 break;
2341 }
2342 break;
2343 }
2344 break;
2345case RISCVVector::BI__builtin_rvv_vfsgnjx_vv_tum:
2346case RISCVVector::BI__builtin_rvv_vfsgnjx_vf_tum:
2347 ID = Intrinsic::riscv_vfsgnjx_mask;
2348 PolicyAttrs = 2;
2349 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2350 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2351 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2352 break;
2353case RISCVVector::BI__builtin_rvv_vfabs_v_tum:
2354 ID = Intrinsic::riscv_vfsgnjx_mask;
2355 PolicyAttrs = 2;
2356IsMasked = true;
2357
2358 {
2359 if (IsMasked) {
2360 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2361 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
2362 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2363 Ops.insert(Ops.begin() + 2, Ops[1]);
2364 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2365 // maskedoff, op1, op2, mask, vl
2366 IntrinsicTypes = {ResultType,
2367 Ops[2]->getType(),
2368 Ops.back()->getType()};
2369 } else {
2370 if (PolicyAttrs & RVV_VTA)
2371 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2372 // op1, po2, vl
2373 IntrinsicTypes = {ResultType,
2374 Ops[1]->getType(), Ops[2]->getType()};
2375 Ops.insert(Ops.begin() + 2, Ops[1]);
2376 break;
2377 }
2378 break;
2379 }
2380 break;
2381case RISCVVector::BI__builtin_rvv_vfsgnjx_vv_tama:
2382case RISCVVector::BI__builtin_rvv_vfsgnjx_vf_tama:
2383 ID = Intrinsic::riscv_vfsgnjx_mask;
2384 PolicyAttrs = 3;
2385 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2386 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2387 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2388 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2389 break;
2390case RISCVVector::BI__builtin_rvv_vfabs_v_tama:
2391 ID = Intrinsic::riscv_vfsgnjx_mask;
2392 PolicyAttrs = 3;
2393IsMasked = true;
2394
2395 {
2396 if (IsMasked) {
2397 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2398 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
2399 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2400 Ops.insert(Ops.begin() + 2, Ops[1]);
2401 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2402 // maskedoff, op1, op2, mask, vl
2403 IntrinsicTypes = {ResultType,
2404 Ops[2]->getType(),
2405 Ops.back()->getType()};
2406 } else {
2407 if (PolicyAttrs & RVV_VTA)
2408 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2409 // op1, po2, vl
2410 IntrinsicTypes = {ResultType,
2411 Ops[1]->getType(), Ops[2]->getType()};
2412 Ops.insert(Ops.begin() + 2, Ops[1]);
2413 break;
2414 }
2415 break;
2416 }
2417 break;
2418case RISCVVector::BI__builtin_rvv_vfsgnjx_vv_tumu:
2419case RISCVVector::BI__builtin_rvv_vfsgnjx_vf_tumu:
2420 ID = Intrinsic::riscv_vfsgnjx_mask;
2421 PolicyAttrs = 0;
2422 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2423 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2424 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2425 break;
2426case RISCVVector::BI__builtin_rvv_vfabs_v_tumu:
2427 ID = Intrinsic::riscv_vfsgnjx_mask;
2428 PolicyAttrs = 0;
2429IsMasked = true;
2430
2431 {
2432 if (IsMasked) {
2433 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2434 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
2435 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2436 Ops.insert(Ops.begin() + 2, Ops[1]);
2437 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2438 // maskedoff, op1, op2, mask, vl
2439 IntrinsicTypes = {ResultType,
2440 Ops[2]->getType(),
2441 Ops.back()->getType()};
2442 } else {
2443 if (PolicyAttrs & RVV_VTA)
2444 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2445 // op1, po2, vl
2446 IntrinsicTypes = {ResultType,
2447 Ops[1]->getType(), Ops[2]->getType()};
2448 Ops.insert(Ops.begin() + 2, Ops[1]);
2449 break;
2450 }
2451 break;
2452 }
2453 break;
2454case RISCVVector::BI__builtin_rvv_vfsgnjx_vv_mu:
2455case RISCVVector::BI__builtin_rvv_vfsgnjx_vf_mu:
2456 ID = Intrinsic::riscv_vfsgnjx_mask;
2457 PolicyAttrs = 1;
2458 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2459 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2460 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2461 break;
2462case RISCVVector::BI__builtin_rvv_vfabs_v_mu:
2463 ID = Intrinsic::riscv_vfsgnjx_mask;
2464 PolicyAttrs = 1;
2465IsMasked = true;
2466
2467 {
2468 if (IsMasked) {
2469 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2470 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
2471 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2472 Ops.insert(Ops.begin() + 2, Ops[1]);
2473 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2474 // maskedoff, op1, op2, mask, vl
2475 IntrinsicTypes = {ResultType,
2476 Ops[2]->getType(),
2477 Ops.back()->getType()};
2478 } else {
2479 if (PolicyAttrs & RVV_VTA)
2480 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2481 // op1, po2, vl
2482 IntrinsicTypes = {ResultType,
2483 Ops[1]->getType(), Ops[2]->getType()};
2484 Ops.insert(Ops.begin() + 2, Ops[1]);
2485 break;
2486 }
2487 break;
2488 }
2489 break;
2490case RISCVVector::BI__builtin_rvv_vfslide1down_vf_tu:
2491 ID = Intrinsic::riscv_vfslide1down;
2492 PolicyAttrs = 2;
2493 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2494 break;
2495case RISCVVector::BI__builtin_rvv_vfslide1down_vf_ta:
2496 ID = Intrinsic::riscv_vfslide1down;
2497 PolicyAttrs = 3;
2498 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2499 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2500 break;
2501case RISCVVector::BI__builtin_rvv_vfslide1down_vf_tum:
2502 ID = Intrinsic::riscv_vfslide1down_mask;
2503 PolicyAttrs = 2;
2504 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2505 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2506 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2507 break;
2508case RISCVVector::BI__builtin_rvv_vfslide1down_vf_tama:
2509 ID = Intrinsic::riscv_vfslide1down_mask;
2510 PolicyAttrs = 3;
2511 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2512 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2513 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2514 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2515 break;
2516case RISCVVector::BI__builtin_rvv_vfslide1down_vf_tumu:
2517 ID = Intrinsic::riscv_vfslide1down_mask;
2518 PolicyAttrs = 0;
2519 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2520 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2521 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2522 break;
2523case RISCVVector::BI__builtin_rvv_vfslide1down_vf_mu:
2524 ID = Intrinsic::riscv_vfslide1down_mask;
2525 PolicyAttrs = 1;
2526 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2527 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2528 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2529 break;
2530case RISCVVector::BI__builtin_rvv_vfslide1up_vf_tu:
2531 ID = Intrinsic::riscv_vfslide1up;
2532 PolicyAttrs = 2;
2533 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2534 break;
2535case RISCVVector::BI__builtin_rvv_vfslide1up_vf_ta:
2536 ID = Intrinsic::riscv_vfslide1up;
2537 PolicyAttrs = 3;
2538 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2539 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2540 break;
2541case RISCVVector::BI__builtin_rvv_vfslide1up_vf_tum:
2542 ID = Intrinsic::riscv_vfslide1up_mask;
2543 PolicyAttrs = 2;
2544 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2545 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2546 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2547 break;
2548case RISCVVector::BI__builtin_rvv_vfslide1up_vf_tama:
2549 ID = Intrinsic::riscv_vfslide1up_mask;
2550 PolicyAttrs = 3;
2551 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2552 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2553 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2554 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2555 break;
2556case RISCVVector::BI__builtin_rvv_vfslide1up_vf_tumu:
2557 ID = Intrinsic::riscv_vfslide1up_mask;
2558 PolicyAttrs = 0;
2559 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2560 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2561 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2562 break;
2563case RISCVVector::BI__builtin_rvv_vfslide1up_vf_mu:
2564 ID = Intrinsic::riscv_vfslide1up_mask;
2565 PolicyAttrs = 1;
2566 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2567 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2568 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2569 break;
2570case RISCVVector::BI__builtin_rvv_vfsqrt_v_tu:
2571 ID = Intrinsic::riscv_vfsqrt;
2572 PolicyAttrs = 2;
2573 IntrinsicTypes = {ResultType, Ops.back()->getType()};
2574 break;
2575case RISCVVector::BI__builtin_rvv_vfsqrt_v_ta:
2576 ID = Intrinsic::riscv_vfsqrt;
2577 PolicyAttrs = 3;
2578 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2579 IntrinsicTypes = {ResultType, Ops.back()->getType()};
2580 break;
2581case RISCVVector::BI__builtin_rvv_vfsqrt_v_tum:
2582 ID = Intrinsic::riscv_vfsqrt_mask;
2583 PolicyAttrs = 2;
2584 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2585 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2586 IntrinsicTypes = {ResultType, Ops.back()->getType()};
2587 break;
2588case RISCVVector::BI__builtin_rvv_vfsqrt_v_tama:
2589 ID = Intrinsic::riscv_vfsqrt_mask;
2590 PolicyAttrs = 3;
2591 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2592 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2593 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2594 IntrinsicTypes = {ResultType, Ops.back()->getType()};
2595 break;
2596case RISCVVector::BI__builtin_rvv_vfsqrt_v_tumu:
2597 ID = Intrinsic::riscv_vfsqrt_mask;
2598 PolicyAttrs = 0;
2599 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2600 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2601 IntrinsicTypes = {ResultType, Ops.back()->getType()};
2602 break;
2603case RISCVVector::BI__builtin_rvv_vfsqrt_v_mu:
2604 ID = Intrinsic::riscv_vfsqrt_mask;
2605 PolicyAttrs = 1;
2606 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2607 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2608 IntrinsicTypes = {ResultType, Ops.back()->getType()};
2609 break;
2610case RISCVVector::BI__builtin_rvv_vfsub_vv_tu:
2611case RISCVVector::BI__builtin_rvv_vfsub_vf_tu:
2612 ID = Intrinsic::riscv_vfsub;
2613 PolicyAttrs = 2;
2614 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2615 break;
2616case RISCVVector::BI__builtin_rvv_vfsub_vv_ta:
2617case RISCVVector::BI__builtin_rvv_vfsub_vf_ta:
2618 ID = Intrinsic::riscv_vfsub;
2619 PolicyAttrs = 3;
2620 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2621 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2622 break;
2623case RISCVVector::BI__builtin_rvv_vfsub_vv_tum:
2624case RISCVVector::BI__builtin_rvv_vfsub_vf_tum:
2625 ID = Intrinsic::riscv_vfsub_mask;
2626 PolicyAttrs = 2;
2627 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2628 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2629 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2630 break;
2631case RISCVVector::BI__builtin_rvv_vfsub_vv_tama:
2632case RISCVVector::BI__builtin_rvv_vfsub_vf_tama:
2633 ID = Intrinsic::riscv_vfsub_mask;
2634 PolicyAttrs = 3;
2635 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2636 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2637 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2638 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2639 break;
2640case RISCVVector::BI__builtin_rvv_vfsub_vv_tumu:
2641case RISCVVector::BI__builtin_rvv_vfsub_vf_tumu:
2642 ID = Intrinsic::riscv_vfsub_mask;
2643 PolicyAttrs = 0;
2644 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2645 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2646 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2647 break;
2648case RISCVVector::BI__builtin_rvv_vfsub_vv_mu:
2649case RISCVVector::BI__builtin_rvv_vfsub_vf_mu:
2650 ID = Intrinsic::riscv_vfsub_mask;
2651 PolicyAttrs = 1;
2652 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2653 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2654 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2655 break;
2656case RISCVVector::BI__builtin_rvv_vfwadd_vv_tu:
2657case RISCVVector::BI__builtin_rvv_vfwadd_vf_tu:
2658 ID = Intrinsic::riscv_vfwadd;
2659 PolicyAttrs = 2;
2660 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
2661 break;
2662case RISCVVector::BI__builtin_rvv_vfwadd_vv_ta:
2663case RISCVVector::BI__builtin_rvv_vfwadd_vf_ta:
2664 ID = Intrinsic::riscv_vfwadd;
2665 PolicyAttrs = 3;
2666 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2667 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
2668 break;
2669case RISCVVector::BI__builtin_rvv_vfwadd_vv_tum:
2670case RISCVVector::BI__builtin_rvv_vfwadd_vf_tum:
2671 ID = Intrinsic::riscv_vfwadd_mask;
2672 PolicyAttrs = 2;
2673 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2674 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2675 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
2676 break;
2677case RISCVVector::BI__builtin_rvv_vfwadd_vv_tama:
2678case RISCVVector::BI__builtin_rvv_vfwadd_vf_tama:
2679 ID = Intrinsic::riscv_vfwadd_mask;
2680 PolicyAttrs = 3;
2681 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2682 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2683 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2684 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
2685 break;
2686case RISCVVector::BI__builtin_rvv_vfwadd_vv_tumu:
2687case RISCVVector::BI__builtin_rvv_vfwadd_vf_tumu:
2688 ID = Intrinsic::riscv_vfwadd_mask;
2689 PolicyAttrs = 0;
2690 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2691 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2692 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
2693 break;
2694case RISCVVector::BI__builtin_rvv_vfwadd_vv_mu:
2695case RISCVVector::BI__builtin_rvv_vfwadd_vf_mu:
2696 ID = Intrinsic::riscv_vfwadd_mask;
2697 PolicyAttrs = 1;
2698 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2699 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2700 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
2701 break;
2702case RISCVVector::BI__builtin_rvv_vfwadd_wv_tu:
2703case RISCVVector::BI__builtin_rvv_vfwadd_wf_tu:
2704 ID = Intrinsic::riscv_vfwadd_w;
2705 PolicyAttrs = 2;
2706 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2707 break;
2708case RISCVVector::BI__builtin_rvv_vfwadd_wv_ta:
2709case RISCVVector::BI__builtin_rvv_vfwadd_wf_ta:
2710 ID = Intrinsic::riscv_vfwadd_w;
2711 PolicyAttrs = 3;
2712 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2713 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2714 break;
2715case RISCVVector::BI__builtin_rvv_vfwadd_wv_tum:
2716case RISCVVector::BI__builtin_rvv_vfwadd_wf_tum:
2717 ID = Intrinsic::riscv_vfwadd_w_mask;
2718 PolicyAttrs = 2;
2719 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2720 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2721 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2722 break;
2723case RISCVVector::BI__builtin_rvv_vfwadd_wv_tama:
2724case RISCVVector::BI__builtin_rvv_vfwadd_wf_tama:
2725 ID = Intrinsic::riscv_vfwadd_w_mask;
2726 PolicyAttrs = 3;
2727 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2728 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2729 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2730 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2731 break;
2732case RISCVVector::BI__builtin_rvv_vfwadd_wv_tumu:
2733case RISCVVector::BI__builtin_rvv_vfwadd_wf_tumu:
2734 ID = Intrinsic::riscv_vfwadd_w_mask;
2735 PolicyAttrs = 0;
2736 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2737 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2738 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2739 break;
2740case RISCVVector::BI__builtin_rvv_vfwadd_wv_mu:
2741case RISCVVector::BI__builtin_rvv_vfwadd_wf_mu:
2742 ID = Intrinsic::riscv_vfwadd_w_mask;
2743 PolicyAttrs = 1;
2744 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2745 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2746 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
2747 break;
2748case RISCVVector::BI__builtin_rvv_vfwcvt_f_f_v_tu:
2749 ID = Intrinsic::riscv_vfwcvt_f_f_v;
2750 PolicyAttrs = 2;
2751 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2752 break;
2753case RISCVVector::BI__builtin_rvv_vfwcvt_f_f_v_ta:
2754 ID = Intrinsic::riscv_vfwcvt_f_f_v;
2755 PolicyAttrs = 3;
2756 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2757 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2758 break;
2759case RISCVVector::BI__builtin_rvv_vfwcvt_f_f_v_tum:
2760 ID = Intrinsic::riscv_vfwcvt_f_f_v_mask;
2761 PolicyAttrs = 2;
2762 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2763 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2764 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2765 break;
2766case RISCVVector::BI__builtin_rvv_vfwcvt_f_f_v_tama:
2767 ID = Intrinsic::riscv_vfwcvt_f_f_v_mask;
2768 PolicyAttrs = 3;
2769 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2770 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2771 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2772 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2773 break;
2774case RISCVVector::BI__builtin_rvv_vfwcvt_f_f_v_tumu:
2775 ID = Intrinsic::riscv_vfwcvt_f_f_v_mask;
2776 PolicyAttrs = 0;
2777 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2778 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2779 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2780 break;
2781case RISCVVector::BI__builtin_rvv_vfwcvt_f_f_v_mu:
2782 ID = Intrinsic::riscv_vfwcvt_f_f_v_mask;
2783 PolicyAttrs = 1;
2784 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2785 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2786 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2787 break;
2788case RISCVVector::BI__builtin_rvv_vfwcvt_f_x_v_tu:
2789 ID = Intrinsic::riscv_vfwcvt_f_x_v;
2790 PolicyAttrs = 2;
2791 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2792 break;
2793case RISCVVector::BI__builtin_rvv_vfwcvt_f_x_v_ta:
2794 ID = Intrinsic::riscv_vfwcvt_f_x_v;
2795 PolicyAttrs = 3;
2796 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2797 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2798 break;
2799case RISCVVector::BI__builtin_rvv_vfwcvt_f_x_v_tum:
2800 ID = Intrinsic::riscv_vfwcvt_f_x_v_mask;
2801 PolicyAttrs = 2;
2802 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2803 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2804 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2805 break;
2806case RISCVVector::BI__builtin_rvv_vfwcvt_f_x_v_tama:
2807 ID = Intrinsic::riscv_vfwcvt_f_x_v_mask;
2808 PolicyAttrs = 3;
2809 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2810 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2811 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2812 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2813 break;
2814case RISCVVector::BI__builtin_rvv_vfwcvt_f_x_v_tumu:
2815 ID = Intrinsic::riscv_vfwcvt_f_x_v_mask;
2816 PolicyAttrs = 0;
2817 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2818 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2819 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2820 break;
2821case RISCVVector::BI__builtin_rvv_vfwcvt_f_x_v_mu:
2822 ID = Intrinsic::riscv_vfwcvt_f_x_v_mask;
2823 PolicyAttrs = 1;
2824 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2825 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2826 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2827 break;
2828case RISCVVector::BI__builtin_rvv_vfwcvt_f_xu_v_tu:
2829 ID = Intrinsic::riscv_vfwcvt_f_xu_v;
2830 PolicyAttrs = 2;
2831 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2832 break;
2833case RISCVVector::BI__builtin_rvv_vfwcvt_f_xu_v_ta:
2834 ID = Intrinsic::riscv_vfwcvt_f_xu_v;
2835 PolicyAttrs = 3;
2836 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2837 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2838 break;
2839case RISCVVector::BI__builtin_rvv_vfwcvt_f_xu_v_tum:
2840 ID = Intrinsic::riscv_vfwcvt_f_xu_v_mask;
2841 PolicyAttrs = 2;
2842 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2843 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2844 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2845 break;
2846case RISCVVector::BI__builtin_rvv_vfwcvt_f_xu_v_tama:
2847 ID = Intrinsic::riscv_vfwcvt_f_xu_v_mask;
2848 PolicyAttrs = 3;
2849 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2850 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2851 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2852 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2853 break;
2854case RISCVVector::BI__builtin_rvv_vfwcvt_f_xu_v_tumu:
2855 ID = Intrinsic::riscv_vfwcvt_f_xu_v_mask;
2856 PolicyAttrs = 0;
2857 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2858 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2859 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2860 break;
2861case RISCVVector::BI__builtin_rvv_vfwcvt_f_xu_v_mu:
2862 ID = Intrinsic::riscv_vfwcvt_f_xu_v_mask;
2863 PolicyAttrs = 1;
2864 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2865 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2866 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2867 break;
2868case RISCVVector::BI__builtin_rvv_vfwcvt_rtz_x_f_v_tu:
2869 ID = Intrinsic::riscv_vfwcvt_rtz_x_f_v;
2870 PolicyAttrs = 2;
2871 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2872 break;
2873case RISCVVector::BI__builtin_rvv_vfwcvt_rtz_x_f_v_ta:
2874 ID = Intrinsic::riscv_vfwcvt_rtz_x_f_v;
2875 PolicyAttrs = 3;
2876 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2877 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2878 break;
2879case RISCVVector::BI__builtin_rvv_vfwcvt_rtz_x_f_v_tum:
2880 ID = Intrinsic::riscv_vfwcvt_rtz_x_f_v_mask;
2881 PolicyAttrs = 2;
2882 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2883 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2884 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2885 break;
2886case RISCVVector::BI__builtin_rvv_vfwcvt_rtz_x_f_v_tama:
2887 ID = Intrinsic::riscv_vfwcvt_rtz_x_f_v_mask;
2888 PolicyAttrs = 3;
2889 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2890 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2891 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2892 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2893 break;
2894case RISCVVector::BI__builtin_rvv_vfwcvt_rtz_x_f_v_tumu:
2895 ID = Intrinsic::riscv_vfwcvt_rtz_x_f_v_mask;
2896 PolicyAttrs = 0;
2897 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2898 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2899 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2900 break;
2901case RISCVVector::BI__builtin_rvv_vfwcvt_rtz_x_f_v_mu:
2902 ID = Intrinsic::riscv_vfwcvt_rtz_x_f_v_mask;
2903 PolicyAttrs = 1;
2904 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2905 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2906 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2907 break;
2908case RISCVVector::BI__builtin_rvv_vfwcvt_rtz_xu_f_v_tu:
2909 ID = Intrinsic::riscv_vfwcvt_rtz_xu_f_v;
2910 PolicyAttrs = 2;
2911 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2912 break;
2913case RISCVVector::BI__builtin_rvv_vfwcvt_rtz_xu_f_v_ta:
2914 ID = Intrinsic::riscv_vfwcvt_rtz_xu_f_v;
2915 PolicyAttrs = 3;
2916 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2917 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2918 break;
2919case RISCVVector::BI__builtin_rvv_vfwcvt_rtz_xu_f_v_tum:
2920 ID = Intrinsic::riscv_vfwcvt_rtz_xu_f_v_mask;
2921 PolicyAttrs = 2;
2922 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2923 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2924 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2925 break;
2926case RISCVVector::BI__builtin_rvv_vfwcvt_rtz_xu_f_v_tama:
2927 ID = Intrinsic::riscv_vfwcvt_rtz_xu_f_v_mask;
2928 PolicyAttrs = 3;
2929 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2930 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2931 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2932 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2933 break;
2934case RISCVVector::BI__builtin_rvv_vfwcvt_rtz_xu_f_v_tumu:
2935 ID = Intrinsic::riscv_vfwcvt_rtz_xu_f_v_mask;
2936 PolicyAttrs = 0;
2937 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2938 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2939 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2940 break;
2941case RISCVVector::BI__builtin_rvv_vfwcvt_rtz_xu_f_v_mu:
2942 ID = Intrinsic::riscv_vfwcvt_rtz_xu_f_v_mask;
2943 PolicyAttrs = 1;
2944 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2945 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2946 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2947 break;
2948case RISCVVector::BI__builtin_rvv_vfwcvt_x_f_v_tu:
2949 ID = Intrinsic::riscv_vfwcvt_x_f_v;
2950 PolicyAttrs = 2;
2951 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2952 break;
2953case RISCVVector::BI__builtin_rvv_vfwcvt_x_f_v_ta:
2954 ID = Intrinsic::riscv_vfwcvt_x_f_v;
2955 PolicyAttrs = 3;
2956 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2957 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2958 break;
2959case RISCVVector::BI__builtin_rvv_vfwcvt_x_f_v_tum:
2960 ID = Intrinsic::riscv_vfwcvt_x_f_v_mask;
2961 PolicyAttrs = 2;
2962 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2963 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2964 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2965 break;
2966case RISCVVector::BI__builtin_rvv_vfwcvt_x_f_v_tama:
2967 ID = Intrinsic::riscv_vfwcvt_x_f_v_mask;
2968 PolicyAttrs = 3;
2969 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2970 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2971 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2972 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2973 break;
2974case RISCVVector::BI__builtin_rvv_vfwcvt_x_f_v_tumu:
2975 ID = Intrinsic::riscv_vfwcvt_x_f_v_mask;
2976 PolicyAttrs = 0;
2977 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2978 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2979 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2980 break;
2981case RISCVVector::BI__builtin_rvv_vfwcvt_x_f_v_mu:
2982 ID = Intrinsic::riscv_vfwcvt_x_f_v_mask;
2983 PolicyAttrs = 1;
2984 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
2985 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
2986 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2987 break;
2988case RISCVVector::BI__builtin_rvv_vfwcvt_xu_f_v_tu:
2989 ID = Intrinsic::riscv_vfwcvt_xu_f_v;
2990 PolicyAttrs = 2;
2991 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2992 break;
2993case RISCVVector::BI__builtin_rvv_vfwcvt_xu_f_v_ta:
2994 ID = Intrinsic::riscv_vfwcvt_xu_f_v;
2995 PolicyAttrs = 3;
2996 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
2997 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
2998 break;
2999case RISCVVector::BI__builtin_rvv_vfwcvt_xu_f_v_tum:
3000 ID = Intrinsic::riscv_vfwcvt_xu_f_v_mask;
3001 PolicyAttrs = 2;
3002 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3003 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3004 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
3005 break;
3006case RISCVVector::BI__builtin_rvv_vfwcvt_xu_f_v_tama:
3007 ID = Intrinsic::riscv_vfwcvt_xu_f_v_mask;
3008 PolicyAttrs = 3;
3009 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3010 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3011 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3012 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
3013 break;
3014case RISCVVector::BI__builtin_rvv_vfwcvt_xu_f_v_tumu:
3015 ID = Intrinsic::riscv_vfwcvt_xu_f_v_mask;
3016 PolicyAttrs = 0;
3017 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3018 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3019 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
3020 break;
3021case RISCVVector::BI__builtin_rvv_vfwcvt_xu_f_v_mu:
3022 ID = Intrinsic::riscv_vfwcvt_xu_f_v_mask;
3023 PolicyAttrs = 1;
3024 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3025 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3026 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
3027 break;
3028case RISCVVector::BI__builtin_rvv_vfwmacc_vv_tu:
3029case RISCVVector::BI__builtin_rvv_vfwmacc_vf_tu:
3030 ID = Intrinsic::riscv_vfwmacc;
3031 PolicyAttrs = 2;
3032 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3033 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3034 break;
3035case RISCVVector::BI__builtin_rvv_vfwmacc_vv_ta:
3036case RISCVVector::BI__builtin_rvv_vfwmacc_vf_ta:
3037 ID = Intrinsic::riscv_vfwmacc;
3038 PolicyAttrs = 3;
3039 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3040 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3041 break;
3042case RISCVVector::BI__builtin_rvv_vfwmacc_vv_tum:
3043case RISCVVector::BI__builtin_rvv_vfwmacc_vf_tum:
3044 ID = Intrinsic::riscv_vfwmacc_mask;
3045 PolicyAttrs = 2;
3046 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3047 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3048 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3049 break;
3050case RISCVVector::BI__builtin_rvv_vfwmacc_vv_tama:
3051case RISCVVector::BI__builtin_rvv_vfwmacc_vf_tama:
3052 ID = Intrinsic::riscv_vfwmacc_mask;
3053 PolicyAttrs = 3;
3054 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3055 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3056 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3057 break;
3058case RISCVVector::BI__builtin_rvv_vfwmacc_vv_tumu:
3059case RISCVVector::BI__builtin_rvv_vfwmacc_vf_tumu:
3060 ID = Intrinsic::riscv_vfwmacc_mask;
3061 PolicyAttrs = 0;
3062 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3063 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3064 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3065 break;
3066case RISCVVector::BI__builtin_rvv_vfwmacc_vv_mu:
3067case RISCVVector::BI__builtin_rvv_vfwmacc_vf_mu:
3068 ID = Intrinsic::riscv_vfwmacc_mask;
3069 PolicyAttrs = 1;
3070 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3071 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3072 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3073 break;
3074case RISCVVector::BI__builtin_rvv_vfwmsac_vv_tu:
3075case RISCVVector::BI__builtin_rvv_vfwmsac_vf_tu:
3076 ID = Intrinsic::riscv_vfwmsac;
3077 PolicyAttrs = 2;
3078 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3079 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3080 break;
3081case RISCVVector::BI__builtin_rvv_vfwmsac_vv_ta:
3082case RISCVVector::BI__builtin_rvv_vfwmsac_vf_ta:
3083 ID = Intrinsic::riscv_vfwmsac;
3084 PolicyAttrs = 3;
3085 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3086 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3087 break;
3088case RISCVVector::BI__builtin_rvv_vfwmsac_vv_tum:
3089case RISCVVector::BI__builtin_rvv_vfwmsac_vf_tum:
3090 ID = Intrinsic::riscv_vfwmsac_mask;
3091 PolicyAttrs = 2;
3092 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3093 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3094 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3095 break;
3096case RISCVVector::BI__builtin_rvv_vfwmsac_vv_tama:
3097case RISCVVector::BI__builtin_rvv_vfwmsac_vf_tama:
3098 ID = Intrinsic::riscv_vfwmsac_mask;
3099 PolicyAttrs = 3;
3100 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3101 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3102 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3103 break;
3104case RISCVVector::BI__builtin_rvv_vfwmsac_vv_tumu:
3105case RISCVVector::BI__builtin_rvv_vfwmsac_vf_tumu:
3106 ID = Intrinsic::riscv_vfwmsac_mask;
3107 PolicyAttrs = 0;
3108 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3109 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3110 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3111 break;
3112case RISCVVector::BI__builtin_rvv_vfwmsac_vv_mu:
3113case RISCVVector::BI__builtin_rvv_vfwmsac_vf_mu:
3114 ID = Intrinsic::riscv_vfwmsac_mask;
3115 PolicyAttrs = 1;
3116 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3117 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3118 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3119 break;
3120case RISCVVector::BI__builtin_rvv_vfwmul_vv_tu:
3121case RISCVVector::BI__builtin_rvv_vfwmul_vf_tu:
3122 ID = Intrinsic::riscv_vfwmul;
3123 PolicyAttrs = 2;
3124 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3125 break;
3126case RISCVVector::BI__builtin_rvv_vfwmul_vv_ta:
3127case RISCVVector::BI__builtin_rvv_vfwmul_vf_ta:
3128 ID = Intrinsic::riscv_vfwmul;
3129 PolicyAttrs = 3;
3130 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3131 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3132 break;
3133case RISCVVector::BI__builtin_rvv_vfwmul_vv_tum:
3134case RISCVVector::BI__builtin_rvv_vfwmul_vf_tum:
3135 ID = Intrinsic::riscv_vfwmul_mask;
3136 PolicyAttrs = 2;
3137 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3138 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3139 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3140 break;
3141case RISCVVector::BI__builtin_rvv_vfwmul_vv_tama:
3142case RISCVVector::BI__builtin_rvv_vfwmul_vf_tama:
3143 ID = Intrinsic::riscv_vfwmul_mask;
3144 PolicyAttrs = 3;
3145 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3146 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3147 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3148 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3149 break;
3150case RISCVVector::BI__builtin_rvv_vfwmul_vv_tumu:
3151case RISCVVector::BI__builtin_rvv_vfwmul_vf_tumu:
3152 ID = Intrinsic::riscv_vfwmul_mask;
3153 PolicyAttrs = 0;
3154 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3155 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3156 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3157 break;
3158case RISCVVector::BI__builtin_rvv_vfwmul_vv_mu:
3159case RISCVVector::BI__builtin_rvv_vfwmul_vf_mu:
3160 ID = Intrinsic::riscv_vfwmul_mask;
3161 PolicyAttrs = 1;
3162 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3163 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3164 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3165 break;
3166case RISCVVector::BI__builtin_rvv_vfwnmacc_vv_tu:
3167case RISCVVector::BI__builtin_rvv_vfwnmacc_vf_tu:
3168 ID = Intrinsic::riscv_vfwnmacc;
3169 PolicyAttrs = 2;
3170 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3171 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3172 break;
3173case RISCVVector::BI__builtin_rvv_vfwnmacc_vv_ta:
3174case RISCVVector::BI__builtin_rvv_vfwnmacc_vf_ta:
3175 ID = Intrinsic::riscv_vfwnmacc;
3176 PolicyAttrs = 3;
3177 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3178 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3179 break;
3180case RISCVVector::BI__builtin_rvv_vfwnmacc_vv_tum:
3181case RISCVVector::BI__builtin_rvv_vfwnmacc_vf_tum:
3182 ID = Intrinsic::riscv_vfwnmacc_mask;
3183 PolicyAttrs = 2;
3184 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3185 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3186 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3187 break;
3188case RISCVVector::BI__builtin_rvv_vfwnmacc_vv_tama:
3189case RISCVVector::BI__builtin_rvv_vfwnmacc_vf_tama:
3190 ID = Intrinsic::riscv_vfwnmacc_mask;
3191 PolicyAttrs = 3;
3192 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3193 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3194 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3195 break;
3196case RISCVVector::BI__builtin_rvv_vfwnmacc_vv_tumu:
3197case RISCVVector::BI__builtin_rvv_vfwnmacc_vf_tumu:
3198 ID = Intrinsic::riscv_vfwnmacc_mask;
3199 PolicyAttrs = 0;
3200 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3201 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3202 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3203 break;
3204case RISCVVector::BI__builtin_rvv_vfwnmacc_vv_mu:
3205case RISCVVector::BI__builtin_rvv_vfwnmacc_vf_mu:
3206 ID = Intrinsic::riscv_vfwnmacc_mask;
3207 PolicyAttrs = 1;
3208 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3209 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3210 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3211 break;
3212case RISCVVector::BI__builtin_rvv_vfwnmsac_vv_tu:
3213case RISCVVector::BI__builtin_rvv_vfwnmsac_vf_tu:
3214 ID = Intrinsic::riscv_vfwnmsac;
3215 PolicyAttrs = 2;
3216 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3217 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3218 break;
3219case RISCVVector::BI__builtin_rvv_vfwnmsac_vv_ta:
3220case RISCVVector::BI__builtin_rvv_vfwnmsac_vf_ta:
3221 ID = Intrinsic::riscv_vfwnmsac;
3222 PolicyAttrs = 3;
3223 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3224 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3225 break;
3226case RISCVVector::BI__builtin_rvv_vfwnmsac_vv_tum:
3227case RISCVVector::BI__builtin_rvv_vfwnmsac_vf_tum:
3228 ID = Intrinsic::riscv_vfwnmsac_mask;
3229 PolicyAttrs = 2;
3230 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3231 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3232 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3233 break;
3234case RISCVVector::BI__builtin_rvv_vfwnmsac_vv_tama:
3235case RISCVVector::BI__builtin_rvv_vfwnmsac_vf_tama:
3236 ID = Intrinsic::riscv_vfwnmsac_mask;
3237 PolicyAttrs = 3;
3238 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3239 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3240 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3241 break;
3242case RISCVVector::BI__builtin_rvv_vfwnmsac_vv_tumu:
3243case RISCVVector::BI__builtin_rvv_vfwnmsac_vf_tumu:
3244 ID = Intrinsic::riscv_vfwnmsac_mask;
3245 PolicyAttrs = 0;
3246 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3247 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3248 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3249 break;
3250case RISCVVector::BI__builtin_rvv_vfwnmsac_vv_mu:
3251case RISCVVector::BI__builtin_rvv_vfwnmsac_vf_mu:
3252 ID = Intrinsic::riscv_vfwnmsac_mask;
3253 PolicyAttrs = 1;
3254 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3255 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3256 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3257 break;
3258case RISCVVector::BI__builtin_rvv_vfwredosum_vs_tu:
3259 ID = Intrinsic::riscv_vfwredosum;
3260 PolicyAttrs = 2;
3261 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
3262 break;
3263case RISCVVector::BI__builtin_rvv_vfwredosum_vs_ta:
3264 ID = Intrinsic::riscv_vfwredosum;
3265 PolicyAttrs = 3;
3266 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3267 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
3268 break;
3269case RISCVVector::BI__builtin_rvv_vfwredosum_vs_tum:
3270 ID = Intrinsic::riscv_vfwredosum_mask;
3271 PolicyAttrs = 2;
3272 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3273 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
3274 break;
3275case RISCVVector::BI__builtin_rvv_vfwredosum_vs_tama:
3276 ID = Intrinsic::riscv_vfwredosum_mask;
3277 PolicyAttrs = 3;
3278 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3279 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3280 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
3281 break;
3282case RISCVVector::BI__builtin_rvv_vfwredusum_vs_tu:
3283 ID = Intrinsic::riscv_vfwredusum;
3284 PolicyAttrs = 2;
3285 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
3286 break;
3287case RISCVVector::BI__builtin_rvv_vfwredusum_vs_ta:
3288 ID = Intrinsic::riscv_vfwredusum;
3289 PolicyAttrs = 3;
3290 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3291 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
3292 break;
3293case RISCVVector::BI__builtin_rvv_vfwredusum_vs_tum:
3294 ID = Intrinsic::riscv_vfwredusum_mask;
3295 PolicyAttrs = 2;
3296 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3297 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
3298 break;
3299case RISCVVector::BI__builtin_rvv_vfwredusum_vs_tama:
3300 ID = Intrinsic::riscv_vfwredusum_mask;
3301 PolicyAttrs = 3;
3302 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3303 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3304 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops.back()->getType()};
3305 break;
3306case RISCVVector::BI__builtin_rvv_vfwsub_vv_tu:
3307case RISCVVector::BI__builtin_rvv_vfwsub_vf_tu:
3308 ID = Intrinsic::riscv_vfwsub;
3309 PolicyAttrs = 2;
3310 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3311 break;
3312case RISCVVector::BI__builtin_rvv_vfwsub_vv_ta:
3313case RISCVVector::BI__builtin_rvv_vfwsub_vf_ta:
3314 ID = Intrinsic::riscv_vfwsub;
3315 PolicyAttrs = 3;
3316 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3317 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3318 break;
3319case RISCVVector::BI__builtin_rvv_vfwsub_vv_tum:
3320case RISCVVector::BI__builtin_rvv_vfwsub_vf_tum:
3321 ID = Intrinsic::riscv_vfwsub_mask;
3322 PolicyAttrs = 2;
3323 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3324 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3325 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3326 break;
3327case RISCVVector::BI__builtin_rvv_vfwsub_vv_tama:
3328case RISCVVector::BI__builtin_rvv_vfwsub_vf_tama:
3329 ID = Intrinsic::riscv_vfwsub_mask;
3330 PolicyAttrs = 3;
3331 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3332 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3333 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3334 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3335 break;
3336case RISCVVector::BI__builtin_rvv_vfwsub_vv_tumu:
3337case RISCVVector::BI__builtin_rvv_vfwsub_vf_tumu:
3338 ID = Intrinsic::riscv_vfwsub_mask;
3339 PolicyAttrs = 0;
3340 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3341 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3342 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3343 break;
3344case RISCVVector::BI__builtin_rvv_vfwsub_vv_mu:
3345case RISCVVector::BI__builtin_rvv_vfwsub_vf_mu:
3346 ID = Intrinsic::riscv_vfwsub_mask;
3347 PolicyAttrs = 1;
3348 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3349 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3350 IntrinsicTypes = {ResultType, Ops[1]->getType(), Ops[2]->getType(), Ops.back()->getType()};
3351 break;
3352case RISCVVector::BI__builtin_rvv_vfwsub_wv_tu:
3353case RISCVVector::BI__builtin_rvv_vfwsub_wf_tu:
3354 ID = Intrinsic::riscv_vfwsub_w;
3355 PolicyAttrs = 2;
3356 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
3357 break;
3358case RISCVVector::BI__builtin_rvv_vfwsub_wv_ta:
3359case RISCVVector::BI__builtin_rvv_vfwsub_wf_ta:
3360 ID = Intrinsic::riscv_vfwsub_w;
3361 PolicyAttrs = 3;
3362 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3363 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
3364 break;
3365case RISCVVector::BI__builtin_rvv_vfwsub_wv_tum:
3366case RISCVVector::BI__builtin_rvv_vfwsub_wf_tum:
3367 ID = Intrinsic::riscv_vfwsub_w_mask;
3368 PolicyAttrs = 2;
3369 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3370 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3371 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
3372 break;
3373case RISCVVector::BI__builtin_rvv_vfwsub_wv_tama:
3374case RISCVVector::BI__builtin_rvv_vfwsub_wf_tama:
3375 ID = Intrinsic::riscv_vfwsub_w_mask;
3376 PolicyAttrs = 3;
3377 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3378 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3379 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3380 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
3381 break;
3382case RISCVVector::BI__builtin_rvv_vfwsub_wv_tumu:
3383case RISCVVector::BI__builtin_rvv_vfwsub_wf_tumu:
3384 ID = Intrinsic::riscv_vfwsub_w_mask;
3385 PolicyAttrs = 0;
3386 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3387 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3388 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
3389 break;
3390case RISCVVector::BI__builtin_rvv_vfwsub_wv_mu:
3391case RISCVVector::BI__builtin_rvv_vfwsub_wf_mu:
3392 ID = Intrinsic::riscv_vfwsub_w_mask;
3393 PolicyAttrs = 1;
3394 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3395 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3396 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
3397 break;
3398case RISCVVector::BI__builtin_rvv_vid_v_tu:
3399 ID = Intrinsic::riscv_vid;
3400 PolicyAttrs = 2;
3401 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3402 break;
3403case RISCVVector::BI__builtin_rvv_vid_v_ta:
3404 ID = Intrinsic::riscv_vid;
3405 PolicyAttrs = 3;
3406 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3407 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3408 break;
3409case RISCVVector::BI__builtin_rvv_vid_v_tum:
3410 ID = Intrinsic::riscv_vid_mask;
3411 PolicyAttrs = 2;
3412 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3413 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3414 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3415 break;
3416case RISCVVector::BI__builtin_rvv_vid_v_tama:
3417 ID = Intrinsic::riscv_vid_mask;
3418 PolicyAttrs = 3;
3419 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3420 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3421 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3422 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3423 break;
3424case RISCVVector::BI__builtin_rvv_vid_v_tumu:
3425 ID = Intrinsic::riscv_vid_mask;
3426 PolicyAttrs = 0;
3427 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3428 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3429 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3430 break;
3431case RISCVVector::BI__builtin_rvv_vid_v_mu:
3432 ID = Intrinsic::riscv_vid_mask;
3433 PolicyAttrs = 1;
3434 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3435 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3436 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3437 break;
3438case RISCVVector::BI__builtin_rvv_viota_m_tu:
3439 ID = Intrinsic::riscv_viota;
3440 PolicyAttrs = 2;
3441 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3442 break;
3443case RISCVVector::BI__builtin_rvv_viota_m_ta:
3444 ID = Intrinsic::riscv_viota;
3445 PolicyAttrs = 3;
3446 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3447 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3448 break;
3449case RISCVVector::BI__builtin_rvv_viota_m_tum:
3450 ID = Intrinsic::riscv_viota_mask;
3451 PolicyAttrs = 2;
3452 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3453 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3454 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3455 break;
3456case RISCVVector::BI__builtin_rvv_viota_m_tama:
3457 ID = Intrinsic::riscv_viota_mask;
3458 PolicyAttrs = 3;
3459 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3460 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3461 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3462 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3463 break;
3464case RISCVVector::BI__builtin_rvv_viota_m_tumu:
3465 ID = Intrinsic::riscv_viota_mask;
3466 PolicyAttrs = 0;
3467 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3468 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3469 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3470 break;
3471case RISCVVector::BI__builtin_rvv_viota_m_mu:
3472 ID = Intrinsic::riscv_viota_mask;
3473 PolicyAttrs = 1;
3474 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3475 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3476 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3477 break;
3478case RISCVVector::BI__builtin_rvv_vle8_v_tu:
3479case RISCVVector::BI__builtin_rvv_vle16_v_tu:
3480case RISCVVector::BI__builtin_rvv_vle32_v_tu:
3481case RISCVVector::BI__builtin_rvv_vle64_v_tu:
3482 ID = Intrinsic::riscv_vle;
3483 PolicyAttrs = 2;
3484 Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo());
3485 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3486 break;
3487case RISCVVector::BI__builtin_rvv_vle8_v_ta:
3488case RISCVVector::BI__builtin_rvv_vle16_v_ta:
3489case RISCVVector::BI__builtin_rvv_vle32_v_ta:
3490case RISCVVector::BI__builtin_rvv_vle64_v_ta:
3491 ID = Intrinsic::riscv_vle;
3492 PolicyAttrs = 3;
3493 Ops[0] = Builder.CreateBitCast(Ops[0], ResultType->getPointerTo());
3494 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3495 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3496 break;
3497case RISCVVector::BI__builtin_rvv_vle8_v_tum:
3498case RISCVVector::BI__builtin_rvv_vle16_v_tum:
3499case RISCVVector::BI__builtin_rvv_vle32_v_tum:
3500case RISCVVector::BI__builtin_rvv_vle64_v_tum:
3501 ID = Intrinsic::riscv_vle_mask;
3502 PolicyAttrs = 2;
3503 Ops[2] = Builder.CreateBitCast(Ops[2], ResultType->getPointerTo());
3504 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3505 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3506 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3507 break;
3508case RISCVVector::BI__builtin_rvv_vle8_v_tama:
3509case RISCVVector::BI__builtin_rvv_vle16_v_tama:
3510case RISCVVector::BI__builtin_rvv_vle32_v_tama:
3511case RISCVVector::BI__builtin_rvv_vle64_v_tama:
3512 ID = Intrinsic::riscv_vle_mask;
3513 PolicyAttrs = 3;
3514 Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo());
3515 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3516 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3517 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3518 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3519 break;
3520case RISCVVector::BI__builtin_rvv_vle8_v_tumu:
3521case RISCVVector::BI__builtin_rvv_vle16_v_tumu:
3522case RISCVVector::BI__builtin_rvv_vle32_v_tumu:
3523case RISCVVector::BI__builtin_rvv_vle64_v_tumu:
3524 ID = Intrinsic::riscv_vle_mask;
3525 PolicyAttrs = 0;
3526 Ops[2] = Builder.CreateBitCast(Ops[2], ResultType->getPointerTo());
3527 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3528 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3529 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3530 break;
3531case RISCVVector::BI__builtin_rvv_vle8_v_mu:
3532case RISCVVector::BI__builtin_rvv_vle16_v_mu:
3533case RISCVVector::BI__builtin_rvv_vle32_v_mu:
3534case RISCVVector::BI__builtin_rvv_vle64_v_mu:
3535 ID = Intrinsic::riscv_vle_mask;
3536 PolicyAttrs = 1;
3537 Ops[2] = Builder.CreateBitCast(Ops[2], ResultType->getPointerTo());
3538 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3539 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3540 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3541 break;
3542case RISCVVector::BI__builtin_rvv_vle16ff_v_tu:
3543case RISCVVector::BI__builtin_rvv_vle32ff_v_tu:
3544case RISCVVector::BI__builtin_rvv_vle64ff_v_tu:
3545case RISCVVector::BI__builtin_rvv_vle8ff_v_tu:
3546 ID = Intrinsic::riscv_vleff;
3547 PolicyAttrs = 2;
3548IsMasked = false;
3549
3550 {
3551 if (IsMasked) {
3552 // Move mask to right before vl.
3553 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3554 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
3555 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3556 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3557 IntrinsicTypes = {ResultType, Ops[4]->getType()};
3558 } else {
3559 if (PolicyAttrs & RVV_VTA)
3560 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3561 IntrinsicTypes = {ResultType, Ops[3]->getType()};
3562 }
3563 Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo());
3564 Value *NewVL = Ops[2];
3565 Ops.erase(Ops.begin() + 2);
3566 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
3567 llvm::Value *LoadValue = Builder.CreateCall(F, Ops, "");
3568 llvm::Value *V = Builder.CreateExtractValue(LoadValue, {0});
3569 // Store new_vl.
3570 clang::CharUnits Align;
3571 if (IsMasked)
3572 Align = CGM.getNaturalPointeeTypeAlignment(E->getArg(E->getNumArgs()-2)->getType());
3573 else
3574 Align = CGM.getNaturalPointeeTypeAlignment(E->getArg(1)->getType());
3575 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {1});
3576 Builder.CreateStore(Val, Address(NewVL, Val->getType(), Align));
3577 return V;
3578 }
3579 break;
3580case RISCVVector::BI__builtin_rvv_vle16ff_v_ta:
3581case RISCVVector::BI__builtin_rvv_vle32ff_v_ta:
3582case RISCVVector::BI__builtin_rvv_vle64ff_v_ta:
3583case RISCVVector::BI__builtin_rvv_vle8ff_v_ta:
3584 ID = Intrinsic::riscv_vleff;
3585 PolicyAttrs = 3;
3586IsMasked = false;
3587
3588 {
3589 if (IsMasked) {
3590 // Move mask to right before vl.
3591 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3592 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
3593 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3594 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3595 IntrinsicTypes = {ResultType, Ops[4]->getType()};
3596 } else {
3597 if (PolicyAttrs & RVV_VTA)
3598 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3599 IntrinsicTypes = {ResultType, Ops[3]->getType()};
3600 }
3601 Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo());
3602 Value *NewVL = Ops[2];
3603 Ops.erase(Ops.begin() + 2);
3604 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
3605 llvm::Value *LoadValue = Builder.CreateCall(F, Ops, "");
3606 llvm::Value *V = Builder.CreateExtractValue(LoadValue, {0});
3607 // Store new_vl.
3608 clang::CharUnits Align;
3609 if (IsMasked)
3610 Align = CGM.getNaturalPointeeTypeAlignment(E->getArg(E->getNumArgs()-2)->getType());
3611 else
3612 Align = CGM.getNaturalPointeeTypeAlignment(E->getArg(1)->getType());
3613 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {1});
3614 Builder.CreateStore(Val, Address(NewVL, Val->getType(), Align));
3615 return V;
3616 }
3617 break;
3618case RISCVVector::BI__builtin_rvv_vle16ff_v_tum:
3619case RISCVVector::BI__builtin_rvv_vle32ff_v_tum:
3620case RISCVVector::BI__builtin_rvv_vle64ff_v_tum:
3621case RISCVVector::BI__builtin_rvv_vle8ff_v_tum:
3622 ID = Intrinsic::riscv_vleff_mask;
3623 PolicyAttrs = 2;
3624IsMasked = true;
3625
3626 {
3627 if (IsMasked) {
3628 // Move mask to right before vl.
3629 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3630 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
3631 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3632 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3633 IntrinsicTypes = {ResultType, Ops[4]->getType()};
3634 } else {
3635 if (PolicyAttrs & RVV_VTA)
3636 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3637 IntrinsicTypes = {ResultType, Ops[3]->getType()};
3638 }
3639 Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo());
3640 Value *NewVL = Ops[2];
3641 Ops.erase(Ops.begin() + 2);
3642 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
3643 llvm::Value *LoadValue = Builder.CreateCall(F, Ops, "");
3644 llvm::Value *V = Builder.CreateExtractValue(LoadValue, {0});
3645 // Store new_vl.
3646 clang::CharUnits Align;
3647 if (IsMasked)
3648 Align = CGM.getNaturalPointeeTypeAlignment(E->getArg(E->getNumArgs()-2)->getType());
3649 else
3650 Align = CGM.getNaturalPointeeTypeAlignment(E->getArg(1)->getType());
3651 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {1});
3652 Builder.CreateStore(Val, Address(NewVL, Val->getType(), Align));
3653 return V;
3654 }
3655 break;
3656case RISCVVector::BI__builtin_rvv_vle16ff_v_tama:
3657case RISCVVector::BI__builtin_rvv_vle32ff_v_tama:
3658case RISCVVector::BI__builtin_rvv_vle64ff_v_tama:
3659case RISCVVector::BI__builtin_rvv_vle8ff_v_tama:
3660 ID = Intrinsic::riscv_vleff_mask;
3661 PolicyAttrs = 3;
3662IsMasked = true;
3663
3664 {
3665 if (IsMasked) {
3666 // Move mask to right before vl.
3667 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3668 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
3669 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3670 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3671 IntrinsicTypes = {ResultType, Ops[4]->getType()};
3672 } else {
3673 if (PolicyAttrs & RVV_VTA)
3674 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3675 IntrinsicTypes = {ResultType, Ops[3]->getType()};
3676 }
3677 Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo());
3678 Value *NewVL = Ops[2];
3679 Ops.erase(Ops.begin() + 2);
3680 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
3681 llvm::Value *LoadValue = Builder.CreateCall(F, Ops, "");
3682 llvm::Value *V = Builder.CreateExtractValue(LoadValue, {0});
3683 // Store new_vl.
3684 clang::CharUnits Align;
3685 if (IsMasked)
3686 Align = CGM.getNaturalPointeeTypeAlignment(E->getArg(E->getNumArgs()-2)->getType());
3687 else
3688 Align = CGM.getNaturalPointeeTypeAlignment(E->getArg(1)->getType());
3689 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {1});
3690 Builder.CreateStore(Val, Address(NewVL, Val->getType(), Align));
3691 return V;
3692 }
3693 break;
3694case RISCVVector::BI__builtin_rvv_vle16ff_v_tumu:
3695case RISCVVector::BI__builtin_rvv_vle32ff_v_tumu:
3696case RISCVVector::BI__builtin_rvv_vle64ff_v_tumu:
3697case RISCVVector::BI__builtin_rvv_vle8ff_v_tumu:
3698 ID = Intrinsic::riscv_vleff_mask;
3699 PolicyAttrs = 0;
3700IsMasked = true;
3701
3702 {
3703 if (IsMasked) {
3704 // Move mask to right before vl.
3705 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3706 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
3707 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3708 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3709 IntrinsicTypes = {ResultType, Ops[4]->getType()};
3710 } else {
3711 if (PolicyAttrs & RVV_VTA)
3712 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3713 IntrinsicTypes = {ResultType, Ops[3]->getType()};
3714 }
3715 Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo());
3716 Value *NewVL = Ops[2];
3717 Ops.erase(Ops.begin() + 2);
3718 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
3719 llvm::Value *LoadValue = Builder.CreateCall(F, Ops, "");
3720 llvm::Value *V = Builder.CreateExtractValue(LoadValue, {0});
3721 // Store new_vl.
3722 clang::CharUnits Align;
3723 if (IsMasked)
3724 Align = CGM.getNaturalPointeeTypeAlignment(E->getArg(E->getNumArgs()-2)->getType());
3725 else
3726 Align = CGM.getNaturalPointeeTypeAlignment(E->getArg(1)->getType());
3727 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {1});
3728 Builder.CreateStore(Val, Address(NewVL, Val->getType(), Align));
3729 return V;
3730 }
3731 break;
3732case RISCVVector::BI__builtin_rvv_vle16ff_v_mu:
3733case RISCVVector::BI__builtin_rvv_vle32ff_v_mu:
3734case RISCVVector::BI__builtin_rvv_vle64ff_v_mu:
3735case RISCVVector::BI__builtin_rvv_vle8ff_v_mu:
3736 ID = Intrinsic::riscv_vleff_mask;
3737 PolicyAttrs = 1;
3738IsMasked = true;
3739
3740 {
3741 if (IsMasked) {
3742 // Move mask to right before vl.
3743 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3744 if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
3745 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3746 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3747 IntrinsicTypes = {ResultType, Ops[4]->getType()};
3748 } else {
3749 if (PolicyAttrs & RVV_VTA)
3750 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3751 IntrinsicTypes = {ResultType, Ops[3]->getType()};
3752 }
3753 Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo());
3754 Value *NewVL = Ops[2];
3755 Ops.erase(Ops.begin() + 2);
3756 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
3757 llvm::Value *LoadValue = Builder.CreateCall(F, Ops, "");
3758 llvm::Value *V = Builder.CreateExtractValue(LoadValue, {0});
3759 // Store new_vl.
3760 clang::CharUnits Align;
3761 if (IsMasked)
3762 Align = CGM.getNaturalPointeeTypeAlignment(E->getArg(E->getNumArgs()-2)->getType());
3763 else
3764 Align = CGM.getNaturalPointeeTypeAlignment(E->getArg(1)->getType());
3765 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {1});
3766 Builder.CreateStore(Val, Address(NewVL, Val->getType(), Align));
3767 return V;
3768 }
3769 break;
3770case RISCVVector::BI__builtin_rvv_vlm_v:
3771 ID = Intrinsic::riscv_vlm;
3772 PolicyAttrs = 3;
3773 Ops[0] = Builder.CreateBitCast(Ops[0], ResultType->getPointerTo());
3774 IntrinsicTypes = {ResultType, Ops.back()->getType()};
3775 break;
3776case RISCVVector::BI__builtin_rvv_vloxei8_v_tu:
3777case RISCVVector::BI__builtin_rvv_vloxei16_v_tu:
3778case RISCVVector::BI__builtin_rvv_vloxei32_v_tu:
3779case RISCVVector::BI__builtin_rvv_vloxei64_v_tu:
3780 ID = Intrinsic::riscv_vloxei;
3781 PolicyAttrs = 2;
3782 Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo());
3783 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
3784 break;
3785case RISCVVector::BI__builtin_rvv_vloxei8_v_ta:
3786case RISCVVector::BI__builtin_rvv_vloxei16_v_ta:
3787case RISCVVector::BI__builtin_rvv_vloxei32_v_ta:
3788case RISCVVector::BI__builtin_rvv_vloxei64_v_ta:
3789 ID = Intrinsic::riscv_vloxei;
3790 PolicyAttrs = 3;
3791 Ops[0] = Builder.CreateBitCast(Ops[0], ResultType->getPointerTo());
3792 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3793 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
3794 break;
3795case RISCVVector::BI__builtin_rvv_vloxei8_v_tum:
3796case RISCVVector::BI__builtin_rvv_vloxei16_v_tum:
3797case RISCVVector::BI__builtin_rvv_vloxei32_v_tum:
3798case RISCVVector::BI__builtin_rvv_vloxei64_v_tum:
3799 ID = Intrinsic::riscv_vloxei_mask;
3800 PolicyAttrs = 2;
3801 Ops[2] = Builder.CreateBitCast(Ops[2], ResultType->getPointerTo());
3802 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3803 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3804 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
3805 break;
3806case RISCVVector::BI__builtin_rvv_vloxei8_v_tama:
3807case RISCVVector::BI__builtin_rvv_vloxei16_v_tama:
3808case RISCVVector::BI__builtin_rvv_vloxei32_v_tama:
3809case RISCVVector::BI__builtin_rvv_vloxei64_v_tama:
3810 ID = Intrinsic::riscv_vloxei_mask;
3811 PolicyAttrs = 3;
3812 Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo());
3813 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3814 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3815 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
3816 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
3817 break;
3818case RISCVVector::BI__builtin_rvv_vloxei8_v_tumu:
3819case RISCVVector::BI__builtin_rvv_vloxei16_v_tumu:
3820case RISCVVector::BI__builtin_rvv_vloxei32_v_tumu:
3821case RISCVVector::BI__builtin_rvv_vloxei64_v_tumu:
3822 ID = Intrinsic::riscv_vloxei_mask;
3823 PolicyAttrs = 0;
3824 Ops[2] = Builder.CreateBitCast(Ops[2], ResultType->getPointerTo());
3825 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3826 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3827 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
3828 break;
3829case RISCVVector::BI__builtin_rvv_vloxei8_v_mu:
3830case RISCVVector::BI__builtin_rvv_vloxei16_v_mu:
3831case RISCVVector::BI__builtin_rvv_vloxei32_v_mu:
3832case RISCVVector::BI__builtin_rvv_vloxei64_v_mu:
3833 ID = Intrinsic::riscv_vloxei_mask;
3834 PolicyAttrs = 1;
3835 Ops[2] = Builder.CreateBitCast(Ops[2], ResultType->getPointerTo());
3836 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
3837 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3838 IntrinsicTypes = {ResultType, Ops[2]->getType(), Ops.back()->getType()};
3839 break;
3840case RISCVVector::BI__builtin_rvv_vloxseg2ei16_v_tu:
3841case RISCVVector::BI__builtin_rvv_vloxseg2ei32_v_tu:
3842case RISCVVector::BI__builtin_rvv_vloxseg2ei64_v_tu:
3843case RISCVVector::BI__builtin_rvv_vloxseg2ei8_v_tu:
3844 ID = Intrinsic::riscv_vloxseg2;
3845 NF = 2;
3846 PolicyAttrs = 2;
3847IsMasked = false;
3848
3849 {
3850 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
3851 SmallVector<llvm::Value*, 12> Operands;
3852
3853 // Please refer to comment under 'defvar NFList' in this file
3854 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
3855 (!IsMasked && PolicyAttrs & RVV_VTA))
3856 Operands.append(NF, llvm::PoisonValue::get(ResultType));
3857 else {
3858 if (IsMasked)
3859 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
3860 else // Unmasked
3861 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
3862 }
3863 unsigned PtrOperandIdx = IsMasked ?
3864 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
3865 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
3866 Value *PtrOperand = Ops[PtrOperandIdx];
3867 Value *IndexOperand = Ops[PtrOperandIdx + 1];
3868 Value *VLOperand = Ops[PtrOperandIdx + 2];
3869 Operands.push_back(PtrOperand);
3870 Operands.push_back(IndexOperand);
3871 if (IsMasked)
3872 Operands.push_back(Ops[NF]);
3873 Operands.push_back(VLOperand);
3874 if (IsMasked)
3875 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3876 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
3877
3878 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
3879 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
3880 clang::CharUnits Align =
3881 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
3882 llvm::Value *V;
3883 for (unsigned I = 0; I < NF; ++I) {
3884 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
3885 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
3886 }
3887 return V;
3888 }
3889 break;
3890case RISCVVector::BI__builtin_rvv_vloxseg2ei16_v_ta:
3891case RISCVVector::BI__builtin_rvv_vloxseg2ei32_v_ta:
3892case RISCVVector::BI__builtin_rvv_vloxseg2ei64_v_ta:
3893case RISCVVector::BI__builtin_rvv_vloxseg2ei8_v_ta:
3894 ID = Intrinsic::riscv_vloxseg2;
3895 NF = 2;
3896 PolicyAttrs = 3;
3897IsMasked = false;
3898
3899 {
3900 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
3901 SmallVector<llvm::Value*, 12> Operands;
3902
3903 // Please refer to comment under 'defvar NFList' in this file
3904 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
3905 (!IsMasked && PolicyAttrs & RVV_VTA))
3906 Operands.append(NF, llvm::PoisonValue::get(ResultType));
3907 else {
3908 if (IsMasked)
3909 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
3910 else // Unmasked
3911 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
3912 }
3913 unsigned PtrOperandIdx = IsMasked ?
3914 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
3915 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
3916 Value *PtrOperand = Ops[PtrOperandIdx];
3917 Value *IndexOperand = Ops[PtrOperandIdx + 1];
3918 Value *VLOperand = Ops[PtrOperandIdx + 2];
3919 Operands.push_back(PtrOperand);
3920 Operands.push_back(IndexOperand);
3921 if (IsMasked)
3922 Operands.push_back(Ops[NF]);
3923 Operands.push_back(VLOperand);
3924 if (IsMasked)
3925 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3926 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
3927
3928 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
3929 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
3930 clang::CharUnits Align =
3931 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
3932 llvm::Value *V;
3933 for (unsigned I = 0; I < NF; ++I) {
3934 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
3935 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
3936 }
3937 return V;
3938 }
3939 break;
3940case RISCVVector::BI__builtin_rvv_vloxseg2ei16_v_tum:
3941case RISCVVector::BI__builtin_rvv_vloxseg2ei32_v_tum:
3942case RISCVVector::BI__builtin_rvv_vloxseg2ei64_v_tum:
3943case RISCVVector::BI__builtin_rvv_vloxseg2ei8_v_tum:
3944 ID = Intrinsic::riscv_vloxseg2_mask;
3945 NF = 2;
3946 PolicyAttrs = 2;
3947IsMasked = true;
3948
3949 {
3950 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
3951 SmallVector<llvm::Value*, 12> Operands;
3952
3953 // Please refer to comment under 'defvar NFList' in this file
3954 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
3955 (!IsMasked && PolicyAttrs & RVV_VTA))
3956 Operands.append(NF, llvm::PoisonValue::get(ResultType));
3957 else {
3958 if (IsMasked)
3959 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
3960 else // Unmasked
3961 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
3962 }
3963 unsigned PtrOperandIdx = IsMasked ?
3964 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
3965 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
3966 Value *PtrOperand = Ops[PtrOperandIdx];
3967 Value *IndexOperand = Ops[PtrOperandIdx + 1];
3968 Value *VLOperand = Ops[PtrOperandIdx + 2];
3969 Operands.push_back(PtrOperand);
3970 Operands.push_back(IndexOperand);
3971 if (IsMasked)
3972 Operands.push_back(Ops[NF]);
3973 Operands.push_back(VLOperand);
3974 if (IsMasked)
3975 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
3976 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
3977
3978 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
3979 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
3980 clang::CharUnits Align =
3981 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
3982 llvm::Value *V;
3983 for (unsigned I = 0; I < NF; ++I) {
3984 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
3985 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
3986 }
3987 return V;
3988 }
3989 break;
3990case RISCVVector::BI__builtin_rvv_vloxseg2ei16_v_tama:
3991case RISCVVector::BI__builtin_rvv_vloxseg2ei32_v_tama:
3992case RISCVVector::BI__builtin_rvv_vloxseg2ei64_v_tama:
3993case RISCVVector::BI__builtin_rvv_vloxseg2ei8_v_tama:
3994 ID = Intrinsic::riscv_vloxseg2_mask;
3995 NF = 2;
3996 PolicyAttrs = 3;
3997IsMasked = true;
3998
3999 {
4000 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4001 SmallVector<llvm::Value*, 12> Operands;
4002
4003 // Please refer to comment under 'defvar NFList' in this file
4004 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4005 (!IsMasked && PolicyAttrs & RVV_VTA))
4006 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4007 else {
4008 if (IsMasked)
4009 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4010 else // Unmasked
4011 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4012 }
4013 unsigned PtrOperandIdx = IsMasked ?
4014 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4015 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4016 Value *PtrOperand = Ops[PtrOperandIdx];
4017 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4018 Value *VLOperand = Ops[PtrOperandIdx + 2];
4019 Operands.push_back(PtrOperand);
4020 Operands.push_back(IndexOperand);
4021 if (IsMasked)
4022 Operands.push_back(Ops[NF]);
4023 Operands.push_back(VLOperand);
4024 if (IsMasked)
4025 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4026 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4027
4028 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4029 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4030 clang::CharUnits Align =
4031 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4032 llvm::Value *V;
4033 for (unsigned I = 0; I < NF; ++I) {
4034 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4035 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4036 }
4037 return V;
4038 }
4039 break;
4040case RISCVVector::BI__builtin_rvv_vloxseg2ei16_v_tumu:
4041case RISCVVector::BI__builtin_rvv_vloxseg2ei32_v_tumu:
4042case RISCVVector::BI__builtin_rvv_vloxseg2ei64_v_tumu:
4043case RISCVVector::BI__builtin_rvv_vloxseg2ei8_v_tumu:
4044 ID = Intrinsic::riscv_vloxseg2_mask;
4045 NF = 2;
4046 PolicyAttrs = 0;
4047IsMasked = true;
4048
4049 {
4050 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4051 SmallVector<llvm::Value*, 12> Operands;
4052
4053 // Please refer to comment under 'defvar NFList' in this file
4054 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4055 (!IsMasked && PolicyAttrs & RVV_VTA))
4056 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4057 else {
4058 if (IsMasked)
4059 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4060 else // Unmasked
4061 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4062 }
4063 unsigned PtrOperandIdx = IsMasked ?
4064 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4065 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4066 Value *PtrOperand = Ops[PtrOperandIdx];
4067 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4068 Value *VLOperand = Ops[PtrOperandIdx + 2];
4069 Operands.push_back(PtrOperand);
4070 Operands.push_back(IndexOperand);
4071 if (IsMasked)
4072 Operands.push_back(Ops[NF]);
4073 Operands.push_back(VLOperand);
4074 if (IsMasked)
4075 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4076 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4077
4078 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4079 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4080 clang::CharUnits Align =
4081 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4082 llvm::Value *V;
4083 for (unsigned I = 0; I < NF; ++I) {
4084 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4085 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4086 }
4087 return V;
4088 }
4089 break;
4090case RISCVVector::BI__builtin_rvv_vloxseg2ei16_v_mu:
4091case RISCVVector::BI__builtin_rvv_vloxseg2ei32_v_mu:
4092case RISCVVector::BI__builtin_rvv_vloxseg2ei64_v_mu:
4093case RISCVVector::BI__builtin_rvv_vloxseg2ei8_v_mu:
4094 ID = Intrinsic::riscv_vloxseg2_mask;
4095 NF = 2;
4096 PolicyAttrs = 1;
4097IsMasked = true;
4098
4099 {
4100 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4101 SmallVector<llvm::Value*, 12> Operands;
4102
4103 // Please refer to comment under 'defvar NFList' in this file
4104 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4105 (!IsMasked && PolicyAttrs & RVV_VTA))
4106 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4107 else {
4108 if (IsMasked)
4109 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4110 else // Unmasked
4111 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4112 }
4113 unsigned PtrOperandIdx = IsMasked ?
4114 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4115 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4116 Value *PtrOperand = Ops[PtrOperandIdx];
4117 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4118 Value *VLOperand = Ops[PtrOperandIdx + 2];
4119 Operands.push_back(PtrOperand);
4120 Operands.push_back(IndexOperand);
4121 if (IsMasked)
4122 Operands.push_back(Ops[NF]);
4123 Operands.push_back(VLOperand);
4124 if (IsMasked)
4125 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4126 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4127
4128 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4129 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4130 clang::CharUnits Align =
4131 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4132 llvm::Value *V;
4133 for (unsigned I = 0; I < NF; ++I) {
4134 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4135 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4136 }
4137 return V;
4138 }
4139 break;
4140case RISCVVector::BI__builtin_rvv_vloxseg3ei8_v_tu:
4141case RISCVVector::BI__builtin_rvv_vloxseg3ei16_v_tu:
4142case RISCVVector::BI__builtin_rvv_vloxseg3ei32_v_tu:
4143case RISCVVector::BI__builtin_rvv_vloxseg3ei64_v_tu:
4144 ID = Intrinsic::riscv_vloxseg3;
4145 NF = 3;
4146 PolicyAttrs = 2;
4147IsMasked = false;
4148
4149 {
4150 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4151 SmallVector<llvm::Value*, 12> Operands;
4152
4153 // Please refer to comment under 'defvar NFList' in this file
4154 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4155 (!IsMasked && PolicyAttrs & RVV_VTA))
4156 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4157 else {
4158 if (IsMasked)
4159 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4160 else // Unmasked
4161 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4162 }
4163 unsigned PtrOperandIdx = IsMasked ?
4164 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4165 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4166 Value *PtrOperand = Ops[PtrOperandIdx];
4167 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4168 Value *VLOperand = Ops[PtrOperandIdx + 2];
4169 Operands.push_back(PtrOperand);
4170 Operands.push_back(IndexOperand);
4171 if (IsMasked)
4172 Operands.push_back(Ops[NF]);
4173 Operands.push_back(VLOperand);
4174 if (IsMasked)
4175 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4176 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4177
4178 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4179 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4180 clang::CharUnits Align =
4181 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4182 llvm::Value *V;
4183 for (unsigned I = 0; I < NF; ++I) {
4184 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4185 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4186 }
4187 return V;
4188 }
4189 break;
4190case RISCVVector::BI__builtin_rvv_vloxseg3ei8_v_ta:
4191case RISCVVector::BI__builtin_rvv_vloxseg3ei16_v_ta:
4192case RISCVVector::BI__builtin_rvv_vloxseg3ei32_v_ta:
4193case RISCVVector::BI__builtin_rvv_vloxseg3ei64_v_ta:
4194 ID = Intrinsic::riscv_vloxseg3;
4195 NF = 3;
4196 PolicyAttrs = 3;
4197IsMasked = false;
4198
4199 {
4200 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4201 SmallVector<llvm::Value*, 12> Operands;
4202
4203 // Please refer to comment under 'defvar NFList' in this file
4204 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4205 (!IsMasked && PolicyAttrs & RVV_VTA))
4206 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4207 else {
4208 if (IsMasked)
4209 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4210 else // Unmasked
4211 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4212 }
4213 unsigned PtrOperandIdx = IsMasked ?
4214 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4215 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4216 Value *PtrOperand = Ops[PtrOperandIdx];
4217 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4218 Value *VLOperand = Ops[PtrOperandIdx + 2];
4219 Operands.push_back(PtrOperand);
4220 Operands.push_back(IndexOperand);
4221 if (IsMasked)
4222 Operands.push_back(Ops[NF]);
4223 Operands.push_back(VLOperand);
4224 if (IsMasked)
4225 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4226 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4227
4228 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4229 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4230 clang::CharUnits Align =
4231 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4232 llvm::Value *V;
4233 for (unsigned I = 0; I < NF; ++I) {
4234 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4235 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4236 }
4237 return V;
4238 }
4239 break;
4240case RISCVVector::BI__builtin_rvv_vloxseg3ei8_v_tum:
4241case RISCVVector::BI__builtin_rvv_vloxseg3ei16_v_tum:
4242case RISCVVector::BI__builtin_rvv_vloxseg3ei32_v_tum:
4243case RISCVVector::BI__builtin_rvv_vloxseg3ei64_v_tum:
4244 ID = Intrinsic::riscv_vloxseg3_mask;
4245 NF = 3;
4246 PolicyAttrs = 2;
4247IsMasked = true;
4248
4249 {
4250 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4251 SmallVector<llvm::Value*, 12> Operands;
4252
4253 // Please refer to comment under 'defvar NFList' in this file
4254 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4255 (!IsMasked && PolicyAttrs & RVV_VTA))
4256 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4257 else {
4258 if (IsMasked)
4259 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4260 else // Unmasked
4261 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4262 }
4263 unsigned PtrOperandIdx = IsMasked ?
4264 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4265 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4266 Value *PtrOperand = Ops[PtrOperandIdx];
4267 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4268 Value *VLOperand = Ops[PtrOperandIdx + 2];
4269 Operands.push_back(PtrOperand);
4270 Operands.push_back(IndexOperand);
4271 if (IsMasked)
4272 Operands.push_back(Ops[NF]);
4273 Operands.push_back(VLOperand);
4274 if (IsMasked)
4275 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4276 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4277
4278 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4279 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4280 clang::CharUnits Align =
4281 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4282 llvm::Value *V;
4283 for (unsigned I = 0; I < NF; ++I) {
4284 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4285 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4286 }
4287 return V;
4288 }
4289 break;
4290case RISCVVector::BI__builtin_rvv_vloxseg3ei8_v_tama:
4291case RISCVVector::BI__builtin_rvv_vloxseg3ei16_v_tama:
4292case RISCVVector::BI__builtin_rvv_vloxseg3ei32_v_tama:
4293case RISCVVector::BI__builtin_rvv_vloxseg3ei64_v_tama:
4294 ID = Intrinsic::riscv_vloxseg3_mask;
4295 NF = 3;
4296 PolicyAttrs = 3;
4297IsMasked = true;
4298
4299 {
4300 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4301 SmallVector<llvm::Value*, 12> Operands;
4302
4303 // Please refer to comment under 'defvar NFList' in this file
4304 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4305 (!IsMasked && PolicyAttrs & RVV_VTA))
4306 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4307 else {
4308 if (IsMasked)
4309 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4310 else // Unmasked
4311 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4312 }
4313 unsigned PtrOperandIdx = IsMasked ?
4314 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4315 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4316 Value *PtrOperand = Ops[PtrOperandIdx];
4317 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4318 Value *VLOperand = Ops[PtrOperandIdx + 2];
4319 Operands.push_back(PtrOperand);
4320 Operands.push_back(IndexOperand);
4321 if (IsMasked)
4322 Operands.push_back(Ops[NF]);
4323 Operands.push_back(VLOperand);
4324 if (IsMasked)
4325 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4326 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4327
4328 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4329 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4330 clang::CharUnits Align =
4331 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4332 llvm::Value *V;
4333 for (unsigned I = 0; I < NF; ++I) {
4334 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4335 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4336 }
4337 return V;
4338 }
4339 break;
4340case RISCVVector::BI__builtin_rvv_vloxseg3ei8_v_tumu:
4341case RISCVVector::BI__builtin_rvv_vloxseg3ei16_v_tumu:
4342case RISCVVector::BI__builtin_rvv_vloxseg3ei32_v_tumu:
4343case RISCVVector::BI__builtin_rvv_vloxseg3ei64_v_tumu:
4344 ID = Intrinsic::riscv_vloxseg3_mask;
4345 NF = 3;
4346 PolicyAttrs = 0;
4347IsMasked = true;
4348
4349 {
4350 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4351 SmallVector<llvm::Value*, 12> Operands;
4352
4353 // Please refer to comment under 'defvar NFList' in this file
4354 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4355 (!IsMasked && PolicyAttrs & RVV_VTA))
4356 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4357 else {
4358 if (IsMasked)
4359 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4360 else // Unmasked
4361 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4362 }
4363 unsigned PtrOperandIdx = IsMasked ?
4364 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4365 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4366 Value *PtrOperand = Ops[PtrOperandIdx];
4367 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4368 Value *VLOperand = Ops[PtrOperandIdx + 2];
4369 Operands.push_back(PtrOperand);
4370 Operands.push_back(IndexOperand);
4371 if (IsMasked)
4372 Operands.push_back(Ops[NF]);
4373 Operands.push_back(VLOperand);
4374 if (IsMasked)
4375 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4376 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4377
4378 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4379 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4380 clang::CharUnits Align =
4381 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4382 llvm::Value *V;
4383 for (unsigned I = 0; I < NF; ++I) {
4384 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4385 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4386 }
4387 return V;
4388 }
4389 break;
4390case RISCVVector::BI__builtin_rvv_vloxseg3ei8_v_mu:
4391case RISCVVector::BI__builtin_rvv_vloxseg3ei16_v_mu:
4392case RISCVVector::BI__builtin_rvv_vloxseg3ei32_v_mu:
4393case RISCVVector::BI__builtin_rvv_vloxseg3ei64_v_mu:
4394 ID = Intrinsic::riscv_vloxseg3_mask;
4395 NF = 3;
4396 PolicyAttrs = 1;
4397IsMasked = true;
4398
4399 {
4400 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4401 SmallVector<llvm::Value*, 12> Operands;
4402
4403 // Please refer to comment under 'defvar NFList' in this file
4404 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4405 (!IsMasked && PolicyAttrs & RVV_VTA))
4406 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4407 else {
4408 if (IsMasked)
4409 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4410 else // Unmasked
4411 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4412 }
4413 unsigned PtrOperandIdx = IsMasked ?
4414 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4415 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4416 Value *PtrOperand = Ops[PtrOperandIdx];
4417 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4418 Value *VLOperand = Ops[PtrOperandIdx + 2];
4419 Operands.push_back(PtrOperand);
4420 Operands.push_back(IndexOperand);
4421 if (IsMasked)
4422 Operands.push_back(Ops[NF]);
4423 Operands.push_back(VLOperand);
4424 if (IsMasked)
4425 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4426 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4427
4428 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4429 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4430 clang::CharUnits Align =
4431 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4432 llvm::Value *V;
4433 for (unsigned I = 0; I < NF; ++I) {
4434 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4435 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4436 }
4437 return V;
4438 }
4439 break;
4440case RISCVVector::BI__builtin_rvv_vloxseg4ei8_v_tu:
4441case RISCVVector::BI__builtin_rvv_vloxseg4ei16_v_tu:
4442case RISCVVector::BI__builtin_rvv_vloxseg4ei32_v_tu:
4443case RISCVVector::BI__builtin_rvv_vloxseg4ei64_v_tu:
4444 ID = Intrinsic::riscv_vloxseg4;
4445 NF = 4;
4446 PolicyAttrs = 2;
4447IsMasked = false;
4448
4449 {
4450 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4451 SmallVector<llvm::Value*, 12> Operands;
4452
4453 // Please refer to comment under 'defvar NFList' in this file
4454 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4455 (!IsMasked && PolicyAttrs & RVV_VTA))
4456 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4457 else {
4458 if (IsMasked)
4459 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4460 else // Unmasked
4461 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4462 }
4463 unsigned PtrOperandIdx = IsMasked ?
4464 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4465 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4466 Value *PtrOperand = Ops[PtrOperandIdx];
4467 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4468 Value *VLOperand = Ops[PtrOperandIdx + 2];
4469 Operands.push_back(PtrOperand);
4470 Operands.push_back(IndexOperand);
4471 if (IsMasked)
4472 Operands.push_back(Ops[NF]);
4473 Operands.push_back(VLOperand);
4474 if (IsMasked)
4475 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4476 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4477
4478 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4479 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4480 clang::CharUnits Align =
4481 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4482 llvm::Value *V;
4483 for (unsigned I = 0; I < NF; ++I) {
4484 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4485 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4486 }
4487 return V;
4488 }
4489 break;
4490case RISCVVector::BI__builtin_rvv_vloxseg4ei8_v_ta:
4491case RISCVVector::BI__builtin_rvv_vloxseg4ei16_v_ta:
4492case RISCVVector::BI__builtin_rvv_vloxseg4ei32_v_ta:
4493case RISCVVector::BI__builtin_rvv_vloxseg4ei64_v_ta:
4494 ID = Intrinsic::riscv_vloxseg4;
4495 NF = 4;
4496 PolicyAttrs = 3;
4497IsMasked = false;
4498
4499 {
4500 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4501 SmallVector<llvm::Value*, 12> Operands;
4502
4503 // Please refer to comment under 'defvar NFList' in this file
4504 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4505 (!IsMasked && PolicyAttrs & RVV_VTA))
4506 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4507 else {
4508 if (IsMasked)
4509 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4510 else // Unmasked
4511 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4512 }
4513 unsigned PtrOperandIdx = IsMasked ?
4514 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4515 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4516 Value *PtrOperand = Ops[PtrOperandIdx];
4517 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4518 Value *VLOperand = Ops[PtrOperandIdx + 2];
4519 Operands.push_back(PtrOperand);
4520 Operands.push_back(IndexOperand);
4521 if (IsMasked)
4522 Operands.push_back(Ops[NF]);
4523 Operands.push_back(VLOperand);
4524 if (IsMasked)
4525 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4526 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4527
4528 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4529 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4530 clang::CharUnits Align =
4531 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4532 llvm::Value *V;
4533 for (unsigned I = 0; I < NF; ++I) {
4534 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4535 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4536 }
4537 return V;
4538 }
4539 break;
4540case RISCVVector::BI__builtin_rvv_vloxseg4ei8_v_tum:
4541case RISCVVector::BI__builtin_rvv_vloxseg4ei16_v_tum:
4542case RISCVVector::BI__builtin_rvv_vloxseg4ei32_v_tum:
4543case RISCVVector::BI__builtin_rvv_vloxseg4ei64_v_tum:
4544 ID = Intrinsic::riscv_vloxseg4_mask;
4545 NF = 4;
4546 PolicyAttrs = 2;
4547IsMasked = true;
4548
4549 {
4550 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4551 SmallVector<llvm::Value*, 12> Operands;
4552
4553 // Please refer to comment under 'defvar NFList' in this file
4554 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4555 (!IsMasked && PolicyAttrs & RVV_VTA))
4556 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4557 else {
4558 if (IsMasked)
4559 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4560 else // Unmasked
4561 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4562 }
4563 unsigned PtrOperandIdx = IsMasked ?
4564 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4565 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4566 Value *PtrOperand = Ops[PtrOperandIdx];
4567 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4568 Value *VLOperand = Ops[PtrOperandIdx + 2];
4569 Operands.push_back(PtrOperand);
4570 Operands.push_back(IndexOperand);
4571 if (IsMasked)
4572 Operands.push_back(Ops[NF]);
4573 Operands.push_back(VLOperand);
4574 if (IsMasked)
4575 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4576 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4577
4578 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4579 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4580 clang::CharUnits Align =
4581 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4582 llvm::Value *V;
4583 for (unsigned I = 0; I < NF; ++I) {
4584 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4585 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4586 }
4587 return V;
4588 }
4589 break;
4590case RISCVVector::BI__builtin_rvv_vloxseg4ei8_v_tama:
4591case RISCVVector::BI__builtin_rvv_vloxseg4ei16_v_tama:
4592case RISCVVector::BI__builtin_rvv_vloxseg4ei32_v_tama:
4593case RISCVVector::BI__builtin_rvv_vloxseg4ei64_v_tama:
4594 ID = Intrinsic::riscv_vloxseg4_mask;
4595 NF = 4;
4596 PolicyAttrs = 3;
4597IsMasked = true;
4598
4599 {
4600 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4601 SmallVector<llvm::Value*, 12> Operands;
4602
4603 // Please refer to comment under 'defvar NFList' in this file
4604 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4605 (!IsMasked && PolicyAttrs & RVV_VTA))
4606 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4607 else {
4608 if (IsMasked)
4609 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4610 else // Unmasked
4611 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4612 }
4613 unsigned PtrOperandIdx = IsMasked ?
4614 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4615 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4616 Value *PtrOperand = Ops[PtrOperandIdx];
4617 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4618 Value *VLOperand = Ops[PtrOperandIdx + 2];
4619 Operands.push_back(PtrOperand);
4620 Operands.push_back(IndexOperand);
4621 if (IsMasked)
4622 Operands.push_back(Ops[NF]);
4623 Operands.push_back(VLOperand);
4624 if (IsMasked)
4625 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4626 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4627
4628 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4629 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4630 clang::CharUnits Align =
4631 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4632 llvm::Value *V;
4633 for (unsigned I = 0; I < NF; ++I) {
4634 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4635 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4636 }
4637 return V;
4638 }
4639 break;
4640case RISCVVector::BI__builtin_rvv_vloxseg4ei8_v_tumu:
4641case RISCVVector::BI__builtin_rvv_vloxseg4ei16_v_tumu:
4642case RISCVVector::BI__builtin_rvv_vloxseg4ei32_v_tumu:
4643case RISCVVector::BI__builtin_rvv_vloxseg4ei64_v_tumu:
4644 ID = Intrinsic::riscv_vloxseg4_mask;
4645 NF = 4;
4646 PolicyAttrs = 0;
4647IsMasked = true;
4648
4649 {
4650 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4651 SmallVector<llvm::Value*, 12> Operands;
4652
4653 // Please refer to comment under 'defvar NFList' in this file
4654 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4655 (!IsMasked && PolicyAttrs & RVV_VTA))
4656 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4657 else {
4658 if (IsMasked)
4659 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4660 else // Unmasked
4661 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4662 }
4663 unsigned PtrOperandIdx = IsMasked ?
4664 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4665 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4666 Value *PtrOperand = Ops[PtrOperandIdx];
4667 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4668 Value *VLOperand = Ops[PtrOperandIdx + 2];
4669 Operands.push_back(PtrOperand);
4670 Operands.push_back(IndexOperand);
4671 if (IsMasked)
4672 Operands.push_back(Ops[NF]);
4673 Operands.push_back(VLOperand);
4674 if (IsMasked)
4675 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4676 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4677
4678 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4679 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4680 clang::CharUnits Align =
4681 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4682 llvm::Value *V;
4683 for (unsigned I = 0; I < NF; ++I) {
4684 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4685 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4686 }
4687 return V;
4688 }
4689 break;
4690case RISCVVector::BI__builtin_rvv_vloxseg4ei8_v_mu:
4691case RISCVVector::BI__builtin_rvv_vloxseg4ei16_v_mu:
4692case RISCVVector::BI__builtin_rvv_vloxseg4ei32_v_mu:
4693case RISCVVector::BI__builtin_rvv_vloxseg4ei64_v_mu:
4694 ID = Intrinsic::riscv_vloxseg4_mask;
4695 NF = 4;
4696 PolicyAttrs = 1;
4697IsMasked = true;
4698
4699 {
4700 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4701 SmallVector<llvm::Value*, 12> Operands;
4702
4703 // Please refer to comment under 'defvar NFList' in this file
4704 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4705 (!IsMasked && PolicyAttrs & RVV_VTA))
4706 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4707 else {
4708 if (IsMasked)
4709 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4710 else // Unmasked
4711 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4712 }
4713 unsigned PtrOperandIdx = IsMasked ?
4714 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4715 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4716 Value *PtrOperand = Ops[PtrOperandIdx];
4717 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4718 Value *VLOperand = Ops[PtrOperandIdx + 2];
4719 Operands.push_back(PtrOperand);
4720 Operands.push_back(IndexOperand);
4721 if (IsMasked)
4722 Operands.push_back(Ops[NF]);
4723 Operands.push_back(VLOperand);
4724 if (IsMasked)
4725 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4726 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4727
4728 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4729 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4730 clang::CharUnits Align =
4731 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4732 llvm::Value *V;
4733 for (unsigned I = 0; I < NF; ++I) {
4734 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4735 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4736 }
4737 return V;
4738 }
4739 break;
4740case RISCVVector::BI__builtin_rvv_vloxseg5ei8_v_tu:
4741case RISCVVector::BI__builtin_rvv_vloxseg5ei16_v_tu:
4742case RISCVVector::BI__builtin_rvv_vloxseg5ei32_v_tu:
4743case RISCVVector::BI__builtin_rvv_vloxseg5ei64_v_tu:
4744 ID = Intrinsic::riscv_vloxseg5;
4745 NF = 5;
4746 PolicyAttrs = 2;
4747IsMasked = false;
4748
4749 {
4750 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4751 SmallVector<llvm::Value*, 12> Operands;
4752
4753 // Please refer to comment under 'defvar NFList' in this file
4754 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4755 (!IsMasked && PolicyAttrs & RVV_VTA))
4756 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4757 else {
4758 if (IsMasked)
4759 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4760 else // Unmasked
4761 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4762 }
4763 unsigned PtrOperandIdx = IsMasked ?
4764 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4765 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4766 Value *PtrOperand = Ops[PtrOperandIdx];
4767 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4768 Value *VLOperand = Ops[PtrOperandIdx + 2];
4769 Operands.push_back(PtrOperand);
4770 Operands.push_back(IndexOperand);
4771 if (IsMasked)
4772 Operands.push_back(Ops[NF]);
4773 Operands.push_back(VLOperand);
4774 if (IsMasked)
4775 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4776 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4777
4778 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4779 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4780 clang::CharUnits Align =
4781 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4782 llvm::Value *V;
4783 for (unsigned I = 0; I < NF; ++I) {
4784 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4785 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4786 }
4787 return V;
4788 }
4789 break;
4790case RISCVVector::BI__builtin_rvv_vloxseg5ei8_v_ta:
4791case RISCVVector::BI__builtin_rvv_vloxseg5ei16_v_ta:
4792case RISCVVector::BI__builtin_rvv_vloxseg5ei32_v_ta:
4793case RISCVVector::BI__builtin_rvv_vloxseg5ei64_v_ta:
4794 ID = Intrinsic::riscv_vloxseg5;
4795 NF = 5;
4796 PolicyAttrs = 3;
4797IsMasked = false;
4798
4799 {
4800 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4801 SmallVector<llvm::Value*, 12> Operands;
4802
4803 // Please refer to comment under 'defvar NFList' in this file
4804 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4805 (!IsMasked && PolicyAttrs & RVV_VTA))
4806 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4807 else {
4808 if (IsMasked)
4809 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4810 else // Unmasked
4811 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4812 }
4813 unsigned PtrOperandIdx = IsMasked ?
4814 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4815 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4816 Value *PtrOperand = Ops[PtrOperandIdx];
4817 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4818 Value *VLOperand = Ops[PtrOperandIdx + 2];
4819 Operands.push_back(PtrOperand);
4820 Operands.push_back(IndexOperand);
4821 if (IsMasked)
4822 Operands.push_back(Ops[NF]);
4823 Operands.push_back(VLOperand);
4824 if (IsMasked)
4825 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4826 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4827
4828 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4829 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4830 clang::CharUnits Align =
4831 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4832 llvm::Value *V;
4833 for (unsigned I = 0; I < NF; ++I) {
4834 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4835 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4836 }
4837 return V;
4838 }
4839 break;
4840case RISCVVector::BI__builtin_rvv_vloxseg5ei8_v_tum:
4841case RISCVVector::BI__builtin_rvv_vloxseg5ei16_v_tum:
4842case RISCVVector::BI__builtin_rvv_vloxseg5ei32_v_tum:
4843case RISCVVector::BI__builtin_rvv_vloxseg5ei64_v_tum:
4844 ID = Intrinsic::riscv_vloxseg5_mask;
4845 NF = 5;
4846 PolicyAttrs = 2;
4847IsMasked = true;
4848
4849 {
4850 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4851 SmallVector<llvm::Value*, 12> Operands;
4852
4853 // Please refer to comment under 'defvar NFList' in this file
4854 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4855 (!IsMasked && PolicyAttrs & RVV_VTA))
4856 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4857 else {
4858 if (IsMasked)
4859 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4860 else // Unmasked
4861 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4862 }
4863 unsigned PtrOperandIdx = IsMasked ?
4864 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4865 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4866 Value *PtrOperand = Ops[PtrOperandIdx];
4867 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4868 Value *VLOperand = Ops[PtrOperandIdx + 2];
4869 Operands.push_back(PtrOperand);
4870 Operands.push_back(IndexOperand);
4871 if (IsMasked)
4872 Operands.push_back(Ops[NF]);
4873 Operands.push_back(VLOperand);
4874 if (IsMasked)
4875 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4876 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4877
4878 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4879 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4880 clang::CharUnits Align =
4881 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4882 llvm::Value *V;
4883 for (unsigned I = 0; I < NF; ++I) {
4884 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4885 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4886 }
4887 return V;
4888 }
4889 break;
4890case RISCVVector::BI__builtin_rvv_vloxseg5ei8_v_tama:
4891case RISCVVector::BI__builtin_rvv_vloxseg5ei16_v_tama:
4892case RISCVVector::BI__builtin_rvv_vloxseg5ei32_v_tama:
4893case RISCVVector::BI__builtin_rvv_vloxseg5ei64_v_tama:
4894 ID = Intrinsic::riscv_vloxseg5_mask;
4895 NF = 5;
4896 PolicyAttrs = 3;
4897IsMasked = true;
4898
4899 {
4900 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4901 SmallVector<llvm::Value*, 12> Operands;
4902
4903 // Please refer to comment under 'defvar NFList' in this file
4904 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4905 (!IsMasked && PolicyAttrs & RVV_VTA))
4906 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4907 else {
4908 if (IsMasked)
4909 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4910 else // Unmasked
4911 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4912 }
4913 unsigned PtrOperandIdx = IsMasked ?
4914 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4915 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4916 Value *PtrOperand = Ops[PtrOperandIdx];
4917 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4918 Value *VLOperand = Ops[PtrOperandIdx + 2];
4919 Operands.push_back(PtrOperand);
4920 Operands.push_back(IndexOperand);
4921 if (IsMasked)
4922 Operands.push_back(Ops[NF]);
4923 Operands.push_back(VLOperand);
4924 if (IsMasked)
4925 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4926 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4927
4928 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4929 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4930 clang::CharUnits Align =
4931 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4932 llvm::Value *V;
4933 for (unsigned I = 0; I < NF; ++I) {
4934 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4935 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4936 }
4937 return V;
4938 }
4939 break;
4940case RISCVVector::BI__builtin_rvv_vloxseg5ei8_v_tumu:
4941case RISCVVector::BI__builtin_rvv_vloxseg5ei16_v_tumu:
4942case RISCVVector::BI__builtin_rvv_vloxseg5ei32_v_tumu:
4943case RISCVVector::BI__builtin_rvv_vloxseg5ei64_v_tumu:
4944 ID = Intrinsic::riscv_vloxseg5_mask;
4945 NF = 5;
4946 PolicyAttrs = 0;
4947IsMasked = true;
4948
4949 {
4950 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
4951 SmallVector<llvm::Value*, 12> Operands;
4952
4953 // Please refer to comment under 'defvar NFList' in this file
4954 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
4955 (!IsMasked && PolicyAttrs & RVV_VTA))
4956 Operands.append(NF, llvm::PoisonValue::get(ResultType));
4957 else {
4958 if (IsMasked)
4959 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
4960 else // Unmasked
4961 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
4962 }
4963 unsigned PtrOperandIdx = IsMasked ?
4964 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
4965 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
4966 Value *PtrOperand = Ops[PtrOperandIdx];
4967 Value *IndexOperand = Ops[PtrOperandIdx + 1];
4968 Value *VLOperand = Ops[PtrOperandIdx + 2];
4969 Operands.push_back(PtrOperand);
4970 Operands.push_back(IndexOperand);
4971 if (IsMasked)
4972 Operands.push_back(Ops[NF]);
4973 Operands.push_back(VLOperand);
4974 if (IsMasked)
4975 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
4976 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
4977
4978 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
4979 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
4980 clang::CharUnits Align =
4981 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
4982 llvm::Value *V;
4983 for (unsigned I = 0; I < NF; ++I) {
4984 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
4985 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
4986 }
4987 return V;
4988 }
4989 break;
4990case RISCVVector::BI__builtin_rvv_vloxseg5ei8_v_mu:
4991case RISCVVector::BI__builtin_rvv_vloxseg5ei16_v_mu:
4992case RISCVVector::BI__builtin_rvv_vloxseg5ei32_v_mu:
4993case RISCVVector::BI__builtin_rvv_vloxseg5ei64_v_mu:
4994 ID = Intrinsic::riscv_vloxseg5_mask;
4995 NF = 5;
4996 PolicyAttrs = 1;
4997IsMasked = true;
4998
4999 {
5000 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5001 SmallVector<llvm::Value*, 12> Operands;
5002
5003 // Please refer to comment under 'defvar NFList' in this file
5004 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5005 (!IsMasked && PolicyAttrs & RVV_VTA))
5006 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5007 else {
5008 if (IsMasked)
5009 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5010 else // Unmasked
5011 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5012 }
5013 unsigned PtrOperandIdx = IsMasked ?
5014 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5015 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5016 Value *PtrOperand = Ops[PtrOperandIdx];
5017 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5018 Value *VLOperand = Ops[PtrOperandIdx + 2];
5019 Operands.push_back(PtrOperand);
5020 Operands.push_back(IndexOperand);
5021 if (IsMasked)
5022 Operands.push_back(Ops[NF]);
5023 Operands.push_back(VLOperand);
5024 if (IsMasked)
5025 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5026 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5027
5028 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5029 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5030 clang::CharUnits Align =
5031 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5032 llvm::Value *V;
5033 for (unsigned I = 0; I < NF; ++I) {
5034 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5035 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5036 }
5037 return V;
5038 }
5039 break;
5040case RISCVVector::BI__builtin_rvv_vloxseg6ei8_v_tu:
5041case RISCVVector::BI__builtin_rvv_vloxseg6ei16_v_tu:
5042case RISCVVector::BI__builtin_rvv_vloxseg6ei32_v_tu:
5043case RISCVVector::BI__builtin_rvv_vloxseg6ei64_v_tu:
5044 ID = Intrinsic::riscv_vloxseg6;
5045 NF = 6;
5046 PolicyAttrs = 2;
5047IsMasked = false;
5048
5049 {
5050 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5051 SmallVector<llvm::Value*, 12> Operands;
5052
5053 // Please refer to comment under 'defvar NFList' in this file
5054 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5055 (!IsMasked && PolicyAttrs & RVV_VTA))
5056 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5057 else {
5058 if (IsMasked)
5059 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5060 else // Unmasked
5061 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5062 }
5063 unsigned PtrOperandIdx = IsMasked ?
5064 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5065 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5066 Value *PtrOperand = Ops[PtrOperandIdx];
5067 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5068 Value *VLOperand = Ops[PtrOperandIdx + 2];
5069 Operands.push_back(PtrOperand);
5070 Operands.push_back(IndexOperand);
5071 if (IsMasked)
5072 Operands.push_back(Ops[NF]);
5073 Operands.push_back(VLOperand);
5074 if (IsMasked)
5075 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5076 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5077
5078 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5079 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5080 clang::CharUnits Align =
5081 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5082 llvm::Value *V;
5083 for (unsigned I = 0; I < NF; ++I) {
5084 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5085 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5086 }
5087 return V;
5088 }
5089 break;
5090case RISCVVector::BI__builtin_rvv_vloxseg6ei8_v_ta:
5091case RISCVVector::BI__builtin_rvv_vloxseg6ei16_v_ta:
5092case RISCVVector::BI__builtin_rvv_vloxseg6ei32_v_ta:
5093case RISCVVector::BI__builtin_rvv_vloxseg6ei64_v_ta:
5094 ID = Intrinsic::riscv_vloxseg6;
5095 NF = 6;
5096 PolicyAttrs = 3;
5097IsMasked = false;
5098
5099 {
5100 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5101 SmallVector<llvm::Value*, 12> Operands;
5102
5103 // Please refer to comment under 'defvar NFList' in this file
5104 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5105 (!IsMasked && PolicyAttrs & RVV_VTA))
5106 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5107 else {
5108 if (IsMasked)
5109 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5110 else // Unmasked
5111 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5112 }
5113 unsigned PtrOperandIdx = IsMasked ?
5114 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5115 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5116 Value *PtrOperand = Ops[PtrOperandIdx];
5117 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5118 Value *VLOperand = Ops[PtrOperandIdx + 2];
5119 Operands.push_back(PtrOperand);
5120 Operands.push_back(IndexOperand);
5121 if (IsMasked)
5122 Operands.push_back(Ops[NF]);
5123 Operands.push_back(VLOperand);
5124 if (IsMasked)
5125 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5126 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5127
5128 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5129 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5130 clang::CharUnits Align =
5131 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5132 llvm::Value *V;
5133 for (unsigned I = 0; I < NF; ++I) {
5134 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5135 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5136 }
5137 return V;
5138 }
5139 break;
5140case RISCVVector::BI__builtin_rvv_vloxseg6ei8_v_tum:
5141case RISCVVector::BI__builtin_rvv_vloxseg6ei16_v_tum:
5142case RISCVVector::BI__builtin_rvv_vloxseg6ei32_v_tum:
5143case RISCVVector::BI__builtin_rvv_vloxseg6ei64_v_tum:
5144 ID = Intrinsic::riscv_vloxseg6_mask;
5145 NF = 6;
5146 PolicyAttrs = 2;
5147IsMasked = true;
5148
5149 {
5150 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5151 SmallVector<llvm::Value*, 12> Operands;
5152
5153 // Please refer to comment under 'defvar NFList' in this file
5154 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5155 (!IsMasked && PolicyAttrs & RVV_VTA))
5156 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5157 else {
5158 if (IsMasked)
5159 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5160 else // Unmasked
5161 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5162 }
5163 unsigned PtrOperandIdx = IsMasked ?
5164 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5165 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5166 Value *PtrOperand = Ops[PtrOperandIdx];
5167 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5168 Value *VLOperand = Ops[PtrOperandIdx + 2];
5169 Operands.push_back(PtrOperand);
5170 Operands.push_back(IndexOperand);
5171 if (IsMasked)
5172 Operands.push_back(Ops[NF]);
5173 Operands.push_back(VLOperand);
5174 if (IsMasked)
5175 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5176 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5177
5178 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5179 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5180 clang::CharUnits Align =
5181 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5182 llvm::Value *V;
5183 for (unsigned I = 0; I < NF; ++I) {
5184 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5185 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5186 }
5187 return V;
5188 }
5189 break;
5190case RISCVVector::BI__builtin_rvv_vloxseg6ei8_v_tama:
5191case RISCVVector::BI__builtin_rvv_vloxseg6ei16_v_tama:
5192case RISCVVector::BI__builtin_rvv_vloxseg6ei32_v_tama:
5193case RISCVVector::BI__builtin_rvv_vloxseg6ei64_v_tama:
5194 ID = Intrinsic::riscv_vloxseg6_mask;
5195 NF = 6;
5196 PolicyAttrs = 3;
5197IsMasked = true;
5198
5199 {
5200 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5201 SmallVector<llvm::Value*, 12> Operands;
5202
5203 // Please refer to comment under 'defvar NFList' in this file
5204 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5205 (!IsMasked && PolicyAttrs & RVV_VTA))
5206 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5207 else {
5208 if (IsMasked)
5209 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5210 else // Unmasked
5211 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5212 }
5213 unsigned PtrOperandIdx = IsMasked ?
5214 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5215 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5216 Value *PtrOperand = Ops[PtrOperandIdx];
5217 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5218 Value *VLOperand = Ops[PtrOperandIdx + 2];
5219 Operands.push_back(PtrOperand);
5220 Operands.push_back(IndexOperand);
5221 if (IsMasked)
5222 Operands.push_back(Ops[NF]);
5223 Operands.push_back(VLOperand);
5224 if (IsMasked)
5225 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5226 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5227
5228 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5229 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5230 clang::CharUnits Align =
5231 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5232 llvm::Value *V;
5233 for (unsigned I = 0; I < NF; ++I) {
5234 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5235 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5236 }
5237 return V;
5238 }
5239 break;
5240case RISCVVector::BI__builtin_rvv_vloxseg6ei8_v_tumu:
5241case RISCVVector::BI__builtin_rvv_vloxseg6ei16_v_tumu:
5242case RISCVVector::BI__builtin_rvv_vloxseg6ei32_v_tumu:
5243case RISCVVector::BI__builtin_rvv_vloxseg6ei64_v_tumu:
5244 ID = Intrinsic::riscv_vloxseg6_mask;
5245 NF = 6;
5246 PolicyAttrs = 0;
5247IsMasked = true;
5248
5249 {
5250 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5251 SmallVector<llvm::Value*, 12> Operands;
5252
5253 // Please refer to comment under 'defvar NFList' in this file
5254 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5255 (!IsMasked && PolicyAttrs & RVV_VTA))
5256 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5257 else {
5258 if (IsMasked)
5259 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5260 else // Unmasked
5261 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5262 }
5263 unsigned PtrOperandIdx = IsMasked ?
5264 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5265 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5266 Value *PtrOperand = Ops[PtrOperandIdx];
5267 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5268 Value *VLOperand = Ops[PtrOperandIdx + 2];
5269 Operands.push_back(PtrOperand);
5270 Operands.push_back(IndexOperand);
5271 if (IsMasked)
5272 Operands.push_back(Ops[NF]);
5273 Operands.push_back(VLOperand);
5274 if (IsMasked)
5275 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5276 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5277
5278 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5279 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5280 clang::CharUnits Align =
5281 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5282 llvm::Value *V;
5283 for (unsigned I = 0; I < NF; ++I) {
5284 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5285 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5286 }
5287 return V;
5288 }
5289 break;
5290case RISCVVector::BI__builtin_rvv_vloxseg6ei8_v_mu:
5291case RISCVVector::BI__builtin_rvv_vloxseg6ei16_v_mu:
5292case RISCVVector::BI__builtin_rvv_vloxseg6ei32_v_mu:
5293case RISCVVector::BI__builtin_rvv_vloxseg6ei64_v_mu:
5294 ID = Intrinsic::riscv_vloxseg6_mask;
5295 NF = 6;
5296 PolicyAttrs = 1;
5297IsMasked = true;
5298
5299 {
5300 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5301 SmallVector<llvm::Value*, 12> Operands;
5302
5303 // Please refer to comment under 'defvar NFList' in this file
5304 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5305 (!IsMasked && PolicyAttrs & RVV_VTA))
5306 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5307 else {
5308 if (IsMasked)
5309 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5310 else // Unmasked
5311 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5312 }
5313 unsigned PtrOperandIdx = IsMasked ?
5314 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5315 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5316 Value *PtrOperand = Ops[PtrOperandIdx];
5317 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5318 Value *VLOperand = Ops[PtrOperandIdx + 2];
5319 Operands.push_back(PtrOperand);
5320 Operands.push_back(IndexOperand);
5321 if (IsMasked)
5322 Operands.push_back(Ops[NF]);
5323 Operands.push_back(VLOperand);
5324 if (IsMasked)
5325 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5326 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5327
5328 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5329 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5330 clang::CharUnits Align =
5331 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5332 llvm::Value *V;
5333 for (unsigned I = 0; I < NF; ++I) {
5334 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5335 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5336 }
5337 return V;
5338 }
5339 break;
5340case RISCVVector::BI__builtin_rvv_vloxseg7ei8_v_tu:
5341case RISCVVector::BI__builtin_rvv_vloxseg7ei16_v_tu:
5342case RISCVVector::BI__builtin_rvv_vloxseg7ei32_v_tu:
5343case RISCVVector::BI__builtin_rvv_vloxseg7ei64_v_tu:
5344 ID = Intrinsic::riscv_vloxseg7;
5345 NF = 7;
5346 PolicyAttrs = 2;
5347IsMasked = false;
5348
5349 {
5350 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5351 SmallVector<llvm::Value*, 12> Operands;
5352
5353 // Please refer to comment under 'defvar NFList' in this file
5354 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5355 (!IsMasked && PolicyAttrs & RVV_VTA))
5356 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5357 else {
5358 if (IsMasked)
5359 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5360 else // Unmasked
5361 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5362 }
5363 unsigned PtrOperandIdx = IsMasked ?
5364 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5365 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5366 Value *PtrOperand = Ops[PtrOperandIdx];
5367 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5368 Value *VLOperand = Ops[PtrOperandIdx + 2];
5369 Operands.push_back(PtrOperand);
5370 Operands.push_back(IndexOperand);
5371 if (IsMasked)
5372 Operands.push_back(Ops[NF]);
5373 Operands.push_back(VLOperand);
5374 if (IsMasked)
5375 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5376 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5377
5378 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5379 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5380 clang::CharUnits Align =
5381 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5382 llvm::Value *V;
5383 for (unsigned I = 0; I < NF; ++I) {
5384 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5385 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5386 }
5387 return V;
5388 }
5389 break;
5390case RISCVVector::BI__builtin_rvv_vloxseg7ei8_v_ta:
5391case RISCVVector::BI__builtin_rvv_vloxseg7ei16_v_ta:
5392case RISCVVector::BI__builtin_rvv_vloxseg7ei32_v_ta:
5393case RISCVVector::BI__builtin_rvv_vloxseg7ei64_v_ta:
5394 ID = Intrinsic::riscv_vloxseg7;
5395 NF = 7;
5396 PolicyAttrs = 3;
5397IsMasked = false;
5398
5399 {
5400 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5401 SmallVector<llvm::Value*, 12> Operands;
5402
5403 // Please refer to comment under 'defvar NFList' in this file
5404 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5405 (!IsMasked && PolicyAttrs & RVV_VTA))
5406 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5407 else {
5408 if (IsMasked)
5409 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5410 else // Unmasked
5411 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5412 }
5413 unsigned PtrOperandIdx = IsMasked ?
5414 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5415 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5416 Value *PtrOperand = Ops[PtrOperandIdx];
5417 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5418 Value *VLOperand = Ops[PtrOperandIdx + 2];
5419 Operands.push_back(PtrOperand);
5420 Operands.push_back(IndexOperand);
5421 if (IsMasked)
5422 Operands.push_back(Ops[NF]);
5423 Operands.push_back(VLOperand);
5424 if (IsMasked)
5425 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5426 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5427
5428 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5429 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5430 clang::CharUnits Align =
5431 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5432 llvm::Value *V;
5433 for (unsigned I = 0; I < NF; ++I) {
5434 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5435 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5436 }
5437 return V;
5438 }
5439 break;
5440case RISCVVector::BI__builtin_rvv_vloxseg7ei8_v_tum:
5441case RISCVVector::BI__builtin_rvv_vloxseg7ei16_v_tum:
5442case RISCVVector::BI__builtin_rvv_vloxseg7ei32_v_tum:
5443case RISCVVector::BI__builtin_rvv_vloxseg7ei64_v_tum:
5444 ID = Intrinsic::riscv_vloxseg7_mask;
5445 NF = 7;
5446 PolicyAttrs = 2;
5447IsMasked = true;
5448
5449 {
5450 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5451 SmallVector<llvm::Value*, 12> Operands;
5452
5453 // Please refer to comment under 'defvar NFList' in this file
5454 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5455 (!IsMasked && PolicyAttrs & RVV_VTA))
5456 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5457 else {
5458 if (IsMasked)
5459 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5460 else // Unmasked
5461 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5462 }
5463 unsigned PtrOperandIdx = IsMasked ?
5464 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5465 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5466 Value *PtrOperand = Ops[PtrOperandIdx];
5467 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5468 Value *VLOperand = Ops[PtrOperandIdx + 2];
5469 Operands.push_back(PtrOperand);
5470 Operands.push_back(IndexOperand);
5471 if (IsMasked)
5472 Operands.push_back(Ops[NF]);
5473 Operands.push_back(VLOperand);
5474 if (IsMasked)
5475 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5476 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5477
5478 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5479 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5480 clang::CharUnits Align =
5481 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5482 llvm::Value *V;
5483 for (unsigned I = 0; I < NF; ++I) {
5484 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5485 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5486 }
5487 return V;
5488 }
5489 break;
5490case RISCVVector::BI__builtin_rvv_vloxseg7ei8_v_tama:
5491case RISCVVector::BI__builtin_rvv_vloxseg7ei16_v_tama:
5492case RISCVVector::BI__builtin_rvv_vloxseg7ei32_v_tama:
5493case RISCVVector::BI__builtin_rvv_vloxseg7ei64_v_tama:
5494 ID = Intrinsic::riscv_vloxseg7_mask;
5495 NF = 7;
5496 PolicyAttrs = 3;
5497IsMasked = true;
5498
5499 {
5500 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5501 SmallVector<llvm::Value*, 12> Operands;
5502
5503 // Please refer to comment under 'defvar NFList' in this file
5504 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5505 (!IsMasked && PolicyAttrs & RVV_VTA))
5506 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5507 else {
5508 if (IsMasked)
5509 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5510 else // Unmasked
5511 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5512 }
5513 unsigned PtrOperandIdx = IsMasked ?
5514 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5515 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5516 Value *PtrOperand = Ops[PtrOperandIdx];
5517 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5518 Value *VLOperand = Ops[PtrOperandIdx + 2];
5519 Operands.push_back(PtrOperand);
5520 Operands.push_back(IndexOperand);
5521 if (IsMasked)
5522 Operands.push_back(Ops[NF]);
5523 Operands.push_back(VLOperand);
5524 if (IsMasked)
5525 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5526 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5527
5528 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5529 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5530 clang::CharUnits Align =
5531 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5532 llvm::Value *V;
5533 for (unsigned I = 0; I < NF; ++I) {
5534 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5535 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5536 }
5537 return V;
5538 }
5539 break;
5540case RISCVVector::BI__builtin_rvv_vloxseg7ei8_v_tumu:
5541case RISCVVector::BI__builtin_rvv_vloxseg7ei16_v_tumu:
5542case RISCVVector::BI__builtin_rvv_vloxseg7ei32_v_tumu:
5543case RISCVVector::BI__builtin_rvv_vloxseg7ei64_v_tumu:
5544 ID = Intrinsic::riscv_vloxseg7_mask;
5545 NF = 7;
5546 PolicyAttrs = 0;
5547IsMasked = true;
5548
5549 {
5550 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5551 SmallVector<llvm::Value*, 12> Operands;
5552
5553 // Please refer to comment under 'defvar NFList' in this file
5554 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5555 (!IsMasked && PolicyAttrs & RVV_VTA))
5556 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5557 else {
5558 if (IsMasked)
5559 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5560 else // Unmasked
5561 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5562 }
5563 unsigned PtrOperandIdx = IsMasked ?
5564 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5565 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5566 Value *PtrOperand = Ops[PtrOperandIdx];
5567 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5568 Value *VLOperand = Ops[PtrOperandIdx + 2];
5569 Operands.push_back(PtrOperand);
5570 Operands.push_back(IndexOperand);
5571 if (IsMasked)
5572 Operands.push_back(Ops[NF]);
5573 Operands.push_back(VLOperand);
5574 if (IsMasked)
5575 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5576 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5577
5578 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5579 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5580 clang::CharUnits Align =
5581 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5582 llvm::Value *V;
5583 for (unsigned I = 0; I < NF; ++I) {
5584 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5585 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5586 }
5587 return V;
5588 }
5589 break;
5590case RISCVVector::BI__builtin_rvv_vloxseg7ei8_v_mu:
5591case RISCVVector::BI__builtin_rvv_vloxseg7ei16_v_mu:
5592case RISCVVector::BI__builtin_rvv_vloxseg7ei32_v_mu:
5593case RISCVVector::BI__builtin_rvv_vloxseg7ei64_v_mu:
5594 ID = Intrinsic::riscv_vloxseg7_mask;
5595 NF = 7;
5596 PolicyAttrs = 1;
5597IsMasked = true;
5598
5599 {
5600 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5601 SmallVector<llvm::Value*, 12> Operands;
5602
5603 // Please refer to comment under 'defvar NFList' in this file
5604 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5605 (!IsMasked && PolicyAttrs & RVV_VTA))
5606 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5607 else {
5608 if (IsMasked)
5609 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5610 else // Unmasked
5611 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5612 }
5613 unsigned PtrOperandIdx = IsMasked ?
5614 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5615 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5616 Value *PtrOperand = Ops[PtrOperandIdx];
5617 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5618 Value *VLOperand = Ops[PtrOperandIdx + 2];
5619 Operands.push_back(PtrOperand);
5620 Operands.push_back(IndexOperand);
5621 if (IsMasked)
5622 Operands.push_back(Ops[NF]);
5623 Operands.push_back(VLOperand);
5624 if (IsMasked)
5625 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5626 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5627
5628 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5629 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5630 clang::CharUnits Align =
5631 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5632 llvm::Value *V;
5633 for (unsigned I = 0; I < NF; ++I) {
5634 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5635 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5636 }
5637 return V;
5638 }
5639 break;
5640case RISCVVector::BI__builtin_rvv_vloxseg8ei8_v_tu:
5641case RISCVVector::BI__builtin_rvv_vloxseg8ei16_v_tu:
5642case RISCVVector::BI__builtin_rvv_vloxseg8ei32_v_tu:
5643case RISCVVector::BI__builtin_rvv_vloxseg8ei64_v_tu:
5644 ID = Intrinsic::riscv_vloxseg8;
5645 NF = 8;
5646 PolicyAttrs = 2;
5647IsMasked = false;
5648
5649 {
5650 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5651 SmallVector<llvm::Value*, 12> Operands;
5652
5653 // Please refer to comment under 'defvar NFList' in this file
5654 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5655 (!IsMasked && PolicyAttrs & RVV_VTA))
5656 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5657 else {
5658 if (IsMasked)
5659 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5660 else // Unmasked
5661 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5662 }
5663 unsigned PtrOperandIdx = IsMasked ?
5664 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5665 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5666 Value *PtrOperand = Ops[PtrOperandIdx];
5667 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5668 Value *VLOperand = Ops[PtrOperandIdx + 2];
5669 Operands.push_back(PtrOperand);
5670 Operands.push_back(IndexOperand);
5671 if (IsMasked)
5672 Operands.push_back(Ops[NF]);
5673 Operands.push_back(VLOperand);
5674 if (IsMasked)
5675 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5676 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5677
5678 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5679 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5680 clang::CharUnits Align =
5681 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5682 llvm::Value *V;
5683 for (unsigned I = 0; I < NF; ++I) {
5684 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5685 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5686 }
5687 return V;
5688 }
5689 break;
5690case RISCVVector::BI__builtin_rvv_vloxseg8ei8_v_ta:
5691case RISCVVector::BI__builtin_rvv_vloxseg8ei16_v_ta:
5692case RISCVVector::BI__builtin_rvv_vloxseg8ei32_v_ta:
5693case RISCVVector::BI__builtin_rvv_vloxseg8ei64_v_ta:
5694 ID = Intrinsic::riscv_vloxseg8;
5695 NF = 8;
5696 PolicyAttrs = 3;
5697IsMasked = false;
5698
5699 {
5700 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5701 SmallVector<llvm::Value*, 12> Operands;
5702
5703 // Please refer to comment under 'defvar NFList' in this file
5704 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5705 (!IsMasked && PolicyAttrs & RVV_VTA))
5706 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5707 else {
5708 if (IsMasked)
5709 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5710 else // Unmasked
5711 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5712 }
5713 unsigned PtrOperandIdx = IsMasked ?
5714 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5715 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5716 Value *PtrOperand = Ops[PtrOperandIdx];
5717 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5718 Value *VLOperand = Ops[PtrOperandIdx + 2];
5719 Operands.push_back(PtrOperand);
5720 Operands.push_back(IndexOperand);
5721 if (IsMasked)
5722 Operands.push_back(Ops[NF]);
5723 Operands.push_back(VLOperand);
5724 if (IsMasked)
5725 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5726 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5727
5728 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5729 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5730 clang::CharUnits Align =
5731 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5732 llvm::Value *V;
5733 for (unsigned I = 0; I < NF; ++I) {
5734 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5735 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5736 }
5737 return V;
5738 }
5739 break;
5740case RISCVVector::BI__builtin_rvv_vloxseg8ei8_v_tum:
5741case RISCVVector::BI__builtin_rvv_vloxseg8ei16_v_tum:
5742case RISCVVector::BI__builtin_rvv_vloxseg8ei32_v_tum:
5743case RISCVVector::BI__builtin_rvv_vloxseg8ei64_v_tum:
5744 ID = Intrinsic::riscv_vloxseg8_mask;
5745 NF = 8;
5746 PolicyAttrs = 2;
5747IsMasked = true;
5748
5749 {
5750 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5751 SmallVector<llvm::Value*, 12> Operands;
5752
5753 // Please refer to comment under 'defvar NFList' in this file
5754 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5755 (!IsMasked && PolicyAttrs & RVV_VTA))
5756 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5757 else {
5758 if (IsMasked)
5759 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5760 else // Unmasked
5761 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5762 }
5763 unsigned PtrOperandIdx = IsMasked ?
5764 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5765 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5766 Value *PtrOperand = Ops[PtrOperandIdx];
5767 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5768 Value *VLOperand = Ops[PtrOperandIdx + 2];
5769 Operands.push_back(PtrOperand);
5770 Operands.push_back(IndexOperand);
5771 if (IsMasked)
5772 Operands.push_back(Ops[NF]);
5773 Operands.push_back(VLOperand);
5774 if (IsMasked)
5775 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5776 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5777
5778 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5779 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5780 clang::CharUnits Align =
5781 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5782 llvm::Value *V;
5783 for (unsigned I = 0; I < NF; ++I) {
5784 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5785 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5786 }
5787 return V;
5788 }
5789 break;
5790case RISCVVector::BI__builtin_rvv_vloxseg8ei8_v_tama:
5791case RISCVVector::BI__builtin_rvv_vloxseg8ei16_v_tama:
5792case RISCVVector::BI__builtin_rvv_vloxseg8ei32_v_tama:
5793case RISCVVector::BI__builtin_rvv_vloxseg8ei64_v_tama:
5794 ID = Intrinsic::riscv_vloxseg8_mask;
5795 NF = 8;
5796 PolicyAttrs = 3;
5797IsMasked = true;
5798
5799 {
5800 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5801 SmallVector<llvm::Value*, 12> Operands;
5802
5803 // Please refer to comment under 'defvar NFList' in this file
5804 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5805 (!IsMasked && PolicyAttrs & RVV_VTA))
5806 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5807 else {
5808 if (IsMasked)
5809 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5810 else // Unmasked
5811 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5812 }
5813 unsigned PtrOperandIdx = IsMasked ?
5814 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5815 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5816 Value *PtrOperand = Ops[PtrOperandIdx];
5817 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5818 Value *VLOperand = Ops[PtrOperandIdx + 2];
5819 Operands.push_back(PtrOperand);
5820 Operands.push_back(IndexOperand);
5821 if (IsMasked)
5822 Operands.push_back(Ops[NF]);
5823 Operands.push_back(VLOperand);
5824 if (IsMasked)
5825 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5826 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5827
5828 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5829 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5830 clang::CharUnits Align =
5831 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5832 llvm::Value *V;
5833 for (unsigned I = 0; I < NF; ++I) {
5834 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5835 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5836 }
5837 return V;
5838 }
5839 break;
5840case RISCVVector::BI__builtin_rvv_vloxseg8ei8_v_tumu:
5841case RISCVVector::BI__builtin_rvv_vloxseg8ei16_v_tumu:
5842case RISCVVector::BI__builtin_rvv_vloxseg8ei32_v_tumu:
5843case RISCVVector::BI__builtin_rvv_vloxseg8ei64_v_tumu:
5844 ID = Intrinsic::riscv_vloxseg8_mask;
5845 NF = 8;
5846 PolicyAttrs = 0;
5847IsMasked = true;
5848
5849 {
5850 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5851 SmallVector<llvm::Value*, 12> Operands;
5852
5853 // Please refer to comment under 'defvar NFList' in this file
5854 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5855 (!IsMasked && PolicyAttrs & RVV_VTA))
5856 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5857 else {
5858 if (IsMasked)
5859 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5860 else // Unmasked
5861 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5862 }
5863 unsigned PtrOperandIdx = IsMasked ?
5864 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5865 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5866 Value *PtrOperand = Ops[PtrOperandIdx];
5867 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5868 Value *VLOperand = Ops[PtrOperandIdx + 2];
5869 Operands.push_back(PtrOperand);
5870 Operands.push_back(IndexOperand);
5871 if (IsMasked)
5872 Operands.push_back(Ops[NF]);
5873 Operands.push_back(VLOperand);
5874 if (IsMasked)
5875 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5876 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5877
5878 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5879 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5880 clang::CharUnits Align =
5881 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5882 llvm::Value *V;
5883 for (unsigned I = 0; I < NF; ++I) {
5884 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5885 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5886 }
5887 return V;
5888 }
5889 break;
5890case RISCVVector::BI__builtin_rvv_vloxseg8ei8_v_mu:
5891case RISCVVector::BI__builtin_rvv_vloxseg8ei16_v_mu:
5892case RISCVVector::BI__builtin_rvv_vloxseg8ei32_v_mu:
5893case RISCVVector::BI__builtin_rvv_vloxseg8ei64_v_mu:
5894 ID = Intrinsic::riscv_vloxseg8_mask;
5895 NF = 8;
5896 PolicyAttrs = 1;
5897IsMasked = true;
5898
5899 {
5900 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
5901 SmallVector<llvm::Value*, 12> Operands;
5902
5903 // Please refer to comment under 'defvar NFList' in this file
5904 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
5905 (!IsMasked && PolicyAttrs & RVV_VTA))
5906 Operands.append(NF, llvm::PoisonValue::get(ResultType));
5907 else {
5908 if (IsMasked)
5909 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
5910 else // Unmasked
5911 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
5912 }
5913 unsigned PtrOperandIdx = IsMasked ?
5914 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
5915 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
5916 Value *PtrOperand = Ops[PtrOperandIdx];
5917 Value *IndexOperand = Ops[PtrOperandIdx + 1];
5918 Value *VLOperand = Ops[PtrOperandIdx + 2];
5919 Operands.push_back(PtrOperand);
5920 Operands.push_back(IndexOperand);
5921 if (IsMasked)
5922 Operands.push_back(Ops[NF]);
5923 Operands.push_back(VLOperand);
5924 if (IsMasked)
5925 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5926 IntrinsicTypes = {ResultType, IndexOperand->getType(), Ops.back()->getType()};
5927
5928 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
5929 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
5930 clang::CharUnits Align =
5931 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
5932 llvm::Value *V;
5933 for (unsigned I = 0; I < NF; ++I) {
5934 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
5935 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
5936 }
5937 return V;
5938 }
5939 break;
5940case RISCVVector::BI__builtin_rvv_vlse32_v_tu:
5941case RISCVVector::BI__builtin_rvv_vlse64_v_tu:
5942case RISCVVector::BI__builtin_rvv_vlse8_v_tu:
5943case RISCVVector::BI__builtin_rvv_vlse16_v_tu:
5944 ID = Intrinsic::riscv_vlse;
5945 PolicyAttrs = 2;
5946 Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo());
5947 IntrinsicTypes = {ResultType, Ops.back()->getType()};
5948 break;
5949case RISCVVector::BI__builtin_rvv_vlse32_v_ta:
5950case RISCVVector::BI__builtin_rvv_vlse64_v_ta:
5951case RISCVVector::BI__builtin_rvv_vlse8_v_ta:
5952case RISCVVector::BI__builtin_rvv_vlse16_v_ta:
5953 ID = Intrinsic::riscv_vlse;
5954 PolicyAttrs = 3;
5955 Ops[0] = Builder.CreateBitCast(Ops[0], ResultType->getPointerTo());
5956 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
5957 IntrinsicTypes = {ResultType, Ops.back()->getType()};
5958 break;
5959case RISCVVector::BI__builtin_rvv_vlse32_v_tum:
5960case RISCVVector::BI__builtin_rvv_vlse64_v_tum:
5961case RISCVVector::BI__builtin_rvv_vlse8_v_tum:
5962case RISCVVector::BI__builtin_rvv_vlse16_v_tum:
5963 ID = Intrinsic::riscv_vlse_mask;
5964 PolicyAttrs = 2;
5965 Ops[2] = Builder.CreateBitCast(Ops[2], ResultType->getPointerTo());
5966 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
5967 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5968 IntrinsicTypes = {ResultType, Ops.back()->getType()};
5969 break;
5970case RISCVVector::BI__builtin_rvv_vlse32_v_tama:
5971case RISCVVector::BI__builtin_rvv_vlse64_v_tama:
5972case RISCVVector::BI__builtin_rvv_vlse8_v_tama:
5973case RISCVVector::BI__builtin_rvv_vlse16_v_tama:
5974 ID = Intrinsic::riscv_vlse_mask;
5975 PolicyAttrs = 3;
5976 Ops[1] = Builder.CreateBitCast(Ops[1], ResultType->getPointerTo());
5977 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
5978 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5979 Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
5980 IntrinsicTypes = {ResultType, Ops.back()->getType()};
5981 break;
5982case RISCVVector::BI__builtin_rvv_vlse32_v_tumu:
5983case RISCVVector::BI__builtin_rvv_vlse64_v_tumu:
5984case RISCVVector::BI__builtin_rvv_vlse8_v_tumu:
5985case RISCVVector::BI__builtin_rvv_vlse16_v_tumu:
5986 ID = Intrinsic::riscv_vlse_mask;
5987 PolicyAttrs = 0;
5988 Ops[2] = Builder.CreateBitCast(Ops[2], ResultType->getPointerTo());
5989 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
5990 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
5991 IntrinsicTypes = {ResultType, Ops.back()->getType()};
5992 break;
5993case RISCVVector::BI__builtin_rvv_vlse32_v_mu:
5994case RISCVVector::BI__builtin_rvv_vlse64_v_mu:
5995case RISCVVector::BI__builtin_rvv_vlse8_v_mu:
5996case RISCVVector::BI__builtin_rvv_vlse16_v_mu:
5997 ID = Intrinsic::riscv_vlse_mask;
5998 PolicyAttrs = 1;
5999 Ops[2] = Builder.CreateBitCast(Ops[2], ResultType->getPointerTo());
6000 std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end() - 1);
6001 Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
6002 IntrinsicTypes = {ResultType, Ops.back()->getType()};
6003 break;
6004case RISCVVector::BI__builtin_rvv_vlseg2e8_v_tu:
6005case RISCVVector::BI__builtin_rvv_vlseg2e16_v_tu:
6006case RISCVVector::BI__builtin_rvv_vlseg2e32_v_tu:
6007case RISCVVector::BI__builtin_rvv_vlseg2e64_v_tu:
6008 ID = Intrinsic::riscv_vlseg2;
6009 NF = 2;
6010 PolicyAttrs = 2;
6011IsMasked = false;
6012
6013 {
6014 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
6015 IntrinsicTypes = {ResultType, Ops.back()->getType()};
6016 SmallVector<llvm::Value*, 12> Operands;
6017
6018 // Please refer to comment under 'defvar NFList' in this file
6019 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
6020 (!IsMasked && PolicyAttrs & RVV_VTA))
6021 Operands.append(NF, llvm::PoisonValue::get(ResultType));
6022 else {
6023 if (IsMasked)
6024 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
6025 else // Unmasked
6026 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
6027 }
6028 unsigned PtrOperandIdx = IsMasked ?
6029 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
6030 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
6031 Value *PtrOperand = Ops[PtrOperandIdx];
6032 Value *VLOperand = Ops[PtrOperandIdx + 1];
6033 Operands.push_back(PtrOperand);
6034 if (IsMasked)
6035 Operands.push_back(Ops[NF]);
6036 Operands.push_back(VLOperand);
6037 if (IsMasked)
6038 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
6039
6040 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
6041 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
6042 clang::CharUnits Align =
6043 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
6044 llvm::Value *V;
6045 for (unsigned I = 0; I < NF; ++I) {
6046 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
6047 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
6048 }
6049 return V;
6050 }
6051 break;
6052case RISCVVector::BI__builtin_rvv_vlseg2e8_v_ta:
6053case RISCVVector::BI__builtin_rvv_vlseg2e16_v_ta:
6054case RISCVVector::BI__builtin_rvv_vlseg2e32_v_ta:
6055case RISCVVector::BI__builtin_rvv_vlseg2e64_v_ta:
6056 ID = Intrinsic::riscv_vlseg2;
6057 NF = 2;
6058 PolicyAttrs = 3;
6059IsMasked = false;
6060
6061 {
6062 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
6063 IntrinsicTypes = {ResultType, Ops.back()->getType()};
6064 SmallVector<llvm::Value*, 12> Operands;
6065
6066 // Please refer to comment under 'defvar NFList' in this file
6067 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
6068 (!IsMasked && PolicyAttrs & RVV_VTA))
6069 Operands.append(NF, llvm::PoisonValue::get(ResultType));
6070 else {
6071 if (IsMasked)
6072 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
6073 else // Unmasked
6074 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
6075 }
6076 unsigned PtrOperandIdx = IsMasked ?
6077 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
6078 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
6079 Value *PtrOperand = Ops[PtrOperandIdx];
6080 Value *VLOperand = Ops[PtrOperandIdx + 1];
6081 Operands.push_back(PtrOperand);
6082 if (IsMasked)
6083 Operands.push_back(Ops[NF]);
6084 Operands.push_back(VLOperand);
6085 if (IsMasked)
6086 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
6087
6088 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
6089 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
6090 clang::CharUnits Align =
6091 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
6092 llvm::Value *V;
6093 for (unsigned I = 0; I < NF; ++I) {
6094 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
6095 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
6096 }
6097 return V;
6098 }
6099 break;
6100case RISCVVector::BI__builtin_rvv_vlseg2e8_v_tum:
6101case RISCVVector::BI__builtin_rvv_vlseg2e16_v_tum:
6102case RISCVVector::BI__builtin_rvv_vlseg2e32_v_tum:
6103case RISCVVector::BI__builtin_rvv_vlseg2e64_v_tum:
6104 ID = Intrinsic::riscv_vlseg2_mask;
6105 NF = 2;
6106 PolicyAttrs = 2;
6107IsMasked = true;
6108
6109 {
6110 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
6111 IntrinsicTypes = {ResultType, Ops.back()->getType()};
6112 SmallVector<llvm::Value*, 12> Operands;
6113
6114 // Please refer to comment under 'defvar NFList' in this file
6115 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
6116 (!IsMasked && PolicyAttrs & RVV_VTA))
6117 Operands.append(NF, llvm::PoisonValue::get(ResultType));
6118 else {
6119 if (IsMasked)
6120 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
6121 else // Unmasked
6122 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
6123 }
6124 unsigned PtrOperandIdx = IsMasked ?
6125 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
6126 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
6127 Value *PtrOperand = Ops[PtrOperandIdx];
6128 Value *VLOperand = Ops[PtrOperandIdx + 1];
6129 Operands.push_back(PtrOperand);
6130 if (IsMasked)
6131 Operands.push_back(Ops[NF]);
6132 Operands.push_back(VLOperand);
6133 if (IsMasked)
6134 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
6135
6136 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
6137 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
6138 clang::CharUnits Align =
6139 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
6140 llvm::Value *V;
6141 for (unsigned I = 0; I < NF; ++I) {
6142 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
6143 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
6144 }
6145 return V;
6146 }
6147 break;
6148case RISCVVector::BI__builtin_rvv_vlseg2e8_v_tama:
6149case RISCVVector::BI__builtin_rvv_vlseg2e16_v_tama:
6150case RISCVVector::BI__builtin_rvv_vlseg2e32_v_tama:
6151case RISCVVector::BI__builtin_rvv_vlseg2e64_v_tama:
6152 ID = Intrinsic::riscv_vlseg2_mask;
6153 NF = 2;
6154 PolicyAttrs = 3;
6155IsMasked = true;
6156
6157 {
6158 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
6159 IntrinsicTypes = {ResultType, Ops.back()->getType()};
6160 SmallVector<llvm::Value*, 12> Operands;
6161
6162 // Please refer to comment under 'defvar NFList' in this file
6163 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
6164 (!IsMasked && PolicyAttrs & RVV_VTA))
6165 Operands.append(NF, llvm::PoisonValue::get(ResultType));
6166 else {
6167 if (IsMasked)
6168 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
6169 else // Unmasked
6170 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
6171 }
6172 unsigned PtrOperandIdx = IsMasked ?
6173 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
6174 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
6175 Value *PtrOperand = Ops[PtrOperandIdx];
6176 Value *VLOperand = Ops[PtrOperandIdx + 1];
6177 Operands.push_back(PtrOperand);
6178 if (IsMasked)
6179 Operands.push_back(Ops[NF]);
6180 Operands.push_back(VLOperand);
6181 if (IsMasked)
6182 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
6183
6184 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
6185 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
6186 clang::CharUnits Align =
6187 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
6188 llvm::Value *V;
6189 for (unsigned I = 0; I < NF; ++I) {
6190 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
6191 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
6192 }
6193 return V;
6194 }
6195 break;
6196case RISCVVector::BI__builtin_rvv_vlseg2e8_v_tumu:
6197case RISCVVector::BI__builtin_rvv_vlseg2e16_v_tumu:
6198case RISCVVector::BI__builtin_rvv_vlseg2e32_v_tumu:
6199case RISCVVector::BI__builtin_rvv_vlseg2e64_v_tumu:
6200 ID = Intrinsic::riscv_vlseg2_mask;
6201 NF = 2;
6202 PolicyAttrs = 0;
6203IsMasked = true;
6204
6205 {
6206 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
6207 IntrinsicTypes = {ResultType, Ops.back()->getType()};
6208 SmallVector<llvm::Value*, 12> Operands;
6209
6210 // Please refer to comment under 'defvar NFList' in this file
6211 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
6212 (!IsMasked && PolicyAttrs & RVV_VTA))
6213 Operands.append(NF, llvm::PoisonValue::get(ResultType));
6214 else {
6215 if (IsMasked)
6216 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
6217 else // Unmasked
6218 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
6219 }
6220 unsigned PtrOperandIdx = IsMasked ?
6221 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
6222 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
6223 Value *PtrOperand = Ops[PtrOperandIdx];
6224 Value *VLOperand = Ops[PtrOperandIdx + 1];
6225 Operands.push_back(PtrOperand);
6226 if (IsMasked)
6227 Operands.push_back(Ops[NF]);
6228 Operands.push_back(VLOperand);
6229 if (IsMasked)
6230 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
6231
6232 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
6233 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
6234 clang::CharUnits Align =
6235 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
6236 llvm::Value *V;
6237 for (unsigned I = 0; I < NF; ++I) {
6238 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
6239 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
6240 }
6241 return V;
6242 }
6243 break;
6244case RISCVVector::BI__builtin_rvv_vlseg2e8_v_mu:
6245case RISCVVector::BI__builtin_rvv_vlseg2e16_v_mu:
6246case RISCVVector::BI__builtin_rvv_vlseg2e32_v_mu:
6247case RISCVVector::BI__builtin_rvv_vlseg2e64_v_mu:
6248 ID = Intrinsic::riscv_vlseg2_mask;
6249 NF = 2;
6250 PolicyAttrs = 1;
6251IsMasked = true;
6252
6253 {
6254 ResultType = ConvertType(E->getArg(0)->getType()->getPointeeType());
6255 IntrinsicTypes = {ResultType, Ops.back()->getType()};
6256 SmallVector<llvm::Value*, 12> Operands;
6257
6258 // Please refer to comment under 'defvar NFList' in this file
6259 if ((IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
6260 (!IsMasked && PolicyAttrs & RVV_VTA))
6261 Operands.append(NF, llvm::PoisonValue::get(ResultType));
6262 else {
6263 if (IsMasked)
6264 Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
6265 else // Unmasked
6266 Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
6267 }
6268 unsigned PtrOperandIdx = IsMasked ?
6269 ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ? NF + 1 : 2 * NF + 1 :
6270 (PolicyAttrs & RVV_VTA) ? NF : 2 * NF;
6271 Value *PtrOperand = Ops[PtrOperandIdx];
6272 Value *VLOperand = Ops[PtrOperandIdx + 1];
6273 Operands.push_back(PtrOperand);
6274 if (IsMasked)
6275 Operands.push_back(Ops[NF]);
6276 Operands.push_back(VLOperand);
6277 if (IsMasked)
6278 Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
6279
6280 llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
6281 llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
6282 clang::CharUnits Align =
6283 CGM.getNaturalPointeeTypeAlignment(E->getArg(0)->getType());
6284 llvm::Value *V;
6285 for (unsigned I = 0; I < NF; ++I) {
6286 llvm::Value *Val = Builder.CreateExtractValue(LoadValue, {I});
6287 V = Builder.CreateStore(Val, Address(Ops[I], Val->getType(), Align));
6288 }
6289 return V;
6290 }
6291 break;
6292case RISCVVector::BI__builtin_rvv_vlseg2e16ff_v_tu:
6293case RISCVVector::BI__builtin_rvv_vlseg2e32ff_v_tu:
6294case RISCVVector::BI__builtin_rvv_vlseg2e64ff_v_tu:
6295case RISCVVector::BI__builtin_rvv_vlseg2e8ff_v_tu:
6296 ID = Intrinsic::riscv_vlseg2ff;