Skip to content

Commit

Permalink
ARM vst mangling needs to be conditional on opaque ptrs
Browse files Browse the repository at this point in the history
The fixes from last week regarding mangling of arm vst intrinsics needs to be made conditional on whether the pointer is opaque or not; this will change based on whether `-D CLANG_ENABLE_OPAQUE_POINTERS=ON|OFF` is defined when LLVM is built, but should be sniffed via this API, according to my LLVM contact.
  • Loading branch information
steven-johnson committed Apr 19, 2022
1 parent 5b412af commit 9901314
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/CodeGen_ARM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,16 +999,21 @@ void CodeGen_ARM::visit(const Store *op) {
// Declare the function
std::ostringstream instr;
vector<llvm::Type *> arg_types;
llvm::Type *intrin_llvm_type = llvm_type_of(intrin_type);
#if LLVM_VERSION >= 150
const bool is_opaque = llvm::PointerType::get(intrin_llvm_type, 0)->isOpaque();
#else
const bool is_opaque = false;
#endif
if (target.bits == 32) {
const char *type_annotation = (LLVM_VERSION < 150) ? ".p0i8" : ".p0";
instr << "llvm.arm.neon.vst"
<< num_vecs
<< type_annotation
<< (is_opaque ? ".p0" : ".p0i8")
<< ".v"
<< intrin_type.lanes()
<< (t.is_float() ? 'f' : 'i')
<< t.bits();
arg_types = vector<llvm::Type *>(num_vecs + 2, llvm_type_of(intrin_type));
arg_types = vector<llvm::Type *>(num_vecs + 2, intrin_llvm_type);
arg_types.front() = i8_t->getPointerTo();
arg_types.back() = i32_t;
} else {
Expand All @@ -1019,11 +1024,10 @@ void CodeGen_ARM::visit(const Store *op) {
<< (t.is_float() ? 'f' : 'i')
<< t.bits()
<< ".p0";
if (LLVM_VERSION < 150) {
instr << (t.is_float() ? 'f' : 'i')
<< t.bits();
if (!is_opaque) {
instr << (t.is_float() ? 'f' : 'i') << t.bits();
}
arg_types = vector<llvm::Type *>(num_vecs + 1, llvm_type_of(intrin_type));
arg_types = vector<llvm::Type *>(num_vecs + 1, intrin_llvm_type);
arg_types.back() = llvm_type_of(intrin_type.element_of())->getPointerTo();
}
llvm::FunctionType *fn_type = FunctionType::get(llvm::Type::getVoidTy(*context), arg_types, false);
Expand Down

0 comments on commit 9901314

Please sign in to comment.