Skip to content

Commit 9901314

Browse files
ARM vst mangling needs to be conditional on opaque ptrs
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.
1 parent 5b412af commit 9901314

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/CodeGen_ARM.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -999,16 +999,21 @@ void CodeGen_ARM::visit(const Store *op) {
999999
// Declare the function
10001000
std::ostringstream instr;
10011001
vector<llvm::Type *> arg_types;
1002+
llvm::Type *intrin_llvm_type = llvm_type_of(intrin_type);
1003+
#if LLVM_VERSION >= 150
1004+
const bool is_opaque = llvm::PointerType::get(intrin_llvm_type, 0)->isOpaque();
1005+
#else
1006+
const bool is_opaque = false;
1007+
#endif
10021008
if (target.bits == 32) {
1003-
const char *type_annotation = (LLVM_VERSION < 150) ? ".p0i8" : ".p0";
10041009
instr << "llvm.arm.neon.vst"
10051010
<< num_vecs
1006-
<< type_annotation
1011+
<< (is_opaque ? ".p0" : ".p0i8")
10071012
<< ".v"
10081013
<< intrin_type.lanes()
10091014
<< (t.is_float() ? 'f' : 'i')
10101015
<< t.bits();
1011-
arg_types = vector<llvm::Type *>(num_vecs + 2, llvm_type_of(intrin_type));
1016+
arg_types = vector<llvm::Type *>(num_vecs + 2, intrin_llvm_type);
10121017
arg_types.front() = i8_t->getPointerTo();
10131018
arg_types.back() = i32_t;
10141019
} else {
@@ -1019,11 +1024,10 @@ void CodeGen_ARM::visit(const Store *op) {
10191024
<< (t.is_float() ? 'f' : 'i')
10201025
<< t.bits()
10211026
<< ".p0";
1022-
if (LLVM_VERSION < 150) {
1023-
instr << (t.is_float() ? 'f' : 'i')
1024-
<< t.bits();
1027+
if (!is_opaque) {
1028+
instr << (t.is_float() ? 'f' : 'i') << t.bits();
10251029
}
1026-
arg_types = vector<llvm::Type *>(num_vecs + 1, llvm_type_of(intrin_type));
1030+
arg_types = vector<llvm::Type *>(num_vecs + 1, intrin_llvm_type);
10271031
arg_types.back() = llvm_type_of(intrin_type.element_of())->getPointerTo();
10281032
}
10291033
llvm::FunctionType *fn_type = FunctionType::get(llvm::Type::getVoidTy(*context), arg_types, false);

0 commit comments

Comments
 (0)