Skip to content

Commit 61b462a

Browse files
Use concat_strings to construct intrin string
1 parent 82e71cd commit 61b462a

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/CodeGen_ARM.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,14 +1970,11 @@ Value *CodeGen_ARM::interleave_vectors(const std::vector<Value *> &vecs) {
19701970
llvm::Type *elt = get_vector_element_type(vecs[0]->getType());
19711971
llvm::Type *ret_type = get_vector_type(elt, src_lanes * stride);
19721972

1973-
std::ostringstream instr;
1974-
instr << "llvm.vector.interleave"
1975-
<< stride
1976-
<< mangle_llvm_type(ret_type);
1973+
std::string instr = concat_strings("llvm.vector.interleave", stride, mangle_llvm_type(ret_type));
19771974

19781975
std::vector<llvm::Type *> arg_types(stride, vecs[0]->getType());
19791976
llvm::FunctionType *fn_type = FunctionType::get(ret_type, arg_types, false);
1980-
FunctionCallee fn = module->getOrInsertFunction(instr.str(), fn_type);
1977+
FunctionCallee fn = module->getOrInsertFunction(instr, fn_type);
19811978

19821979
CallInst *interleave = builder->CreateCall(fn, vecs);
19831980
return interleave;
@@ -2021,17 +2018,14 @@ Value *CodeGen_ARM::shuffle_vectors(Value *a, Value *b, const std::vector<int> &
20212018
dst_lanes % target_vscale() == 0 &&
20222019
dst_lanes / target_vscale() > 1) {
20232020

2024-
std::ostringstream instr;
2025-
instr << "llvm.vector.deinterleave"
2026-
<< slice_stride
2027-
<< mangle_llvm_type(a->getType());
2021+
std::string instr = concat_strings("llvm.vector.deinterleave", slice_stride, mangle_llvm_type(a->getType()));
20282022

20292023
// We cannot mix FixedVector and ScalableVector, so dst_type must be scalable
20302024
llvm::Type *dst_type = get_vector_type(elt, dst_lanes / target_vscale(), VectorTypeConstraint::VScale);
20312025
StructType *sret_type = StructType::get(*context, std::vector(slice_stride, dst_type));
20322026
std::vector<llvm::Type *> arg_types{a->getType()};
20332027
llvm::FunctionType *fn_type = FunctionType::get(sret_type, arg_types, false);
2034-
FunctionCallee fn = module->getOrInsertFunction(instr.str(), fn_type);
2028+
FunctionCallee fn = module->getOrInsertFunction(instr, fn_type);
20352029

20362030
CallInst *deinterleave = builder->CreateCall(fn, {a});
20372031
// extract one element out of the returned struct

0 commit comments

Comments
 (0)