forked from OSchip/llvm-project
Add some additional capabilities to the neon emitter
llvm-svn: 105416
This commit is contained in:
parent
8fb957e5cb
commit
64b76bd4f7
|
@ -41,7 +41,8 @@ enum OpKind {
|
||||||
OpOr,
|
OpOr,
|
||||||
OpXor,
|
OpXor,
|
||||||
OpAndNot,
|
OpAndNot,
|
||||||
OpOrNot
|
OpOrNot,
|
||||||
|
OpCast
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ParseTypes(Record *r, std::string &s,
|
static void ParseTypes(Record *r, std::string &s,
|
||||||
|
@ -85,6 +86,19 @@ static char Widen(const char t) {
|
||||||
return '\0';
|
return '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char Narrow(const char t) {
|
||||||
|
switch (t) {
|
||||||
|
case 's':
|
||||||
|
return 'c';
|
||||||
|
case 'i':
|
||||||
|
return 's';
|
||||||
|
case 'l':
|
||||||
|
return 'i';
|
||||||
|
default: throw "unhandled type in widen!";
|
||||||
|
}
|
||||||
|
return '\0';
|
||||||
|
}
|
||||||
|
|
||||||
static char ClassifyType(StringRef ty, bool &quad, bool &poly, bool &usgn) {
|
static char ClassifyType(StringRef ty, bool &quad, bool &poly, bool &usgn) {
|
||||||
unsigned off = 0;
|
unsigned off = 0;
|
||||||
|
|
||||||
|
@ -167,6 +181,13 @@ static std::string TypeString(const char mod, StringRef typestr) {
|
||||||
pntr = true;
|
pntr = true;
|
||||||
scal = true;
|
scal = true;
|
||||||
break;
|
break;
|
||||||
|
case 'h':
|
||||||
|
type = Narrow(type);
|
||||||
|
break;
|
||||||
|
case 'e':
|
||||||
|
type = Narrow(type);
|
||||||
|
usgn = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -308,9 +329,11 @@ static std::string GenOpString(OpKind op, const std::string &proto,
|
||||||
if (structTypes)
|
if (structTypes)
|
||||||
s += "(" + ts + "){";
|
s += "(" + ts + "){";
|
||||||
|
|
||||||
std::string a = structTypes ? "a.val" : "a";
|
std::string a, b, c;
|
||||||
std::string b = structTypes ? "b.val" : "b";
|
if (proto.size() > 1)
|
||||||
std::string c = structTypes ? "c.val" : "c";
|
a = (structTypes && proto[1] != 'l') ? "a.val" : "a";
|
||||||
|
b = structTypes ? "b.val" : "b";
|
||||||
|
c = structTypes ? "c.val" : "c";
|
||||||
|
|
||||||
switch(op) {
|
switch(op) {
|
||||||
case OpAdd:
|
case OpAdd:
|
||||||
|
@ -364,6 +387,9 @@ static std::string GenOpString(OpKind op, const std::string &proto,
|
||||||
case OpOrNot:
|
case OpOrNot:
|
||||||
s += a + " | ~" + b;
|
s += a + " | ~" + b;
|
||||||
break;
|
break;
|
||||||
|
case OpCast:
|
||||||
|
s += "(__neon_" + ts + ")" + a;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw "unknown OpKind!";
|
throw "unknown OpKind!";
|
||||||
break;
|
break;
|
||||||
|
@ -489,6 +515,7 @@ void NeonEmitter::run(raw_ostream &OS) {
|
||||||
OpMap["OP_XOR"] = OpXor;
|
OpMap["OP_XOR"] = OpXor;
|
||||||
OpMap["OP_ANDN"] = OpAndNot;
|
OpMap["OP_ANDN"] = OpAndNot;
|
||||||
OpMap["OP_ORN"] = OpOrNot;
|
OpMap["OP_ORN"] = OpOrNot;
|
||||||
|
OpMap["OP_CAST"] = OpCast;
|
||||||
|
|
||||||
// Unique the return+pattern types, and assign them.
|
// Unique the return+pattern types, and assign them.
|
||||||
for (unsigned i = 0, e = RV.size(); i != e; ++i) {
|
for (unsigned i = 0, e = RV.size(); i != e; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue