Emit vmovl intrinsics first in the arm_neon.h header

so they can be used in the implementations of other intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121208 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bob Wilson 2010-12-07 23:53:32 +00:00
parent 4f4363a490
commit da1d3dc9a5
2 changed files with 49 additions and 35 deletions

View File

@ -1040,49 +1040,60 @@ void NeonEmitter::run(raw_ostream &OS) {
std::vector<Record*> RV = Records.getAllDerivedDefinitions("Inst");
// Emit vmovl intrinsics first so they can be used by other intrinsics.
emitIntrinsic(OS, Records.getDef("VMOVL"));
// Unique the return+pattern types, and assign them.
for (unsigned i = 0, e = RV.size(); i != e; ++i) {
Record *R = RV[i];
std::string name = R->getValueAsString("Name");
std::string Proto = R->getValueAsString("Prototype");
std::string Types = R->getValueAsString("Types");
SmallVector<StringRef, 16> TypeVec;
ParseTypes(R, Types, TypeVec);
OpKind kind = OpMap[R->getValueAsDef("Operand")->getName()];
ClassKind classKind = ClassNone;
if (R->getSuperClasses().size() >= 2)
classKind = ClassMap[R->getSuperClasses()[1]];
if (classKind == ClassNone && kind == OpNone)
throw TGError(R->getLoc(), "Builtin has no class kind");
for (unsigned ti = 0, te = TypeVec.size(); ti != te; ++ti) {
if (kind == OpReinterpret) {
bool outQuad = false;
bool dummy = false;
(void)ClassifyType(TypeVec[ti], outQuad, dummy, dummy);
for (unsigned srcti = 0, srcte = TypeVec.size();
srcti != srcte; ++srcti) {
bool inQuad = false;
(void)ClassifyType(TypeVec[srcti], inQuad, dummy, dummy);
if (srcti == ti || inQuad != outQuad)
continue;
OS << GenIntrinsic(name, Proto, TypeVec[ti], TypeVec[srcti],
OpCast, ClassS);
}
} else {
OS << GenIntrinsic(name, Proto, TypeVec[ti], TypeVec[ti],
kind, classKind);
}
}
OS << "\n";
if (R->getName() != "VMOVL")
emitIntrinsic(OS, R);
}
OS << "#undef __ai\n\n";
OS << "#endif /* __ARM_NEON_H */\n";
}
/// emitIntrinsic - Write out the arm_neon.h header file definitions for the
/// intrinsics specified by record R.
void NeonEmitter::emitIntrinsic(raw_ostream &OS, Record *R) {
std::string name = R->getValueAsString("Name");
std::string Proto = R->getValueAsString("Prototype");
std::string Types = R->getValueAsString("Types");
SmallVector<StringRef, 16> TypeVec;
ParseTypes(R, Types, TypeVec);
OpKind kind = OpMap[R->getValueAsDef("Operand")->getName()];
ClassKind classKind = ClassNone;
if (R->getSuperClasses().size() >= 2)
classKind = ClassMap[R->getSuperClasses()[1]];
if (classKind == ClassNone && kind == OpNone)
throw TGError(R->getLoc(), "Builtin has no class kind");
for (unsigned ti = 0, te = TypeVec.size(); ti != te; ++ti) {
if (kind == OpReinterpret) {
bool outQuad = false;
bool dummy = false;
(void)ClassifyType(TypeVec[ti], outQuad, dummy, dummy);
for (unsigned srcti = 0, srcte = TypeVec.size();
srcti != srcte; ++srcti) {
bool inQuad = false;
(void)ClassifyType(TypeVec[srcti], inQuad, dummy, dummy);
if (srcti == ti || inQuad != outQuad)
continue;
OS << GenIntrinsic(name, Proto, TypeVec[ti], TypeVec[srcti],
OpCast, ClassS);
}
} else {
OS << GenIntrinsic(name, Proto, TypeVec[ti], TypeVec[ti],
kind, classKind);
}
}
OS << "\n";
}
static unsigned RangeFromType(StringRef typestr) {
// base type to get the type string for.
bool quad = false, dummy = false;

View File

@ -131,6 +131,9 @@ namespace llvm {
// runHeader - Emit all the __builtin prototypes used in arm_neon.h
void runHeader(raw_ostream &o);
private:
void emitIntrinsic(raw_ostream &OS, Record *R);
};
} // End llvm namespace