[llvm-commits] [llvm] r105416 - /llvm/trunk/utils/TableGen/NeonEmitter.cpp
Nate Begeman
natebegeman at mac.com
Thu Jun 3 14:35:23 PDT 2010
Author: sampo
Date: Thu Jun 3 16:35:22 2010
New Revision: 105416
URL: http://llvm.org/viewvc/llvm-project?rev=105416&view=rev
Log:
Add some additional capabilities to the neon emitter
Modified:
llvm/trunk/utils/TableGen/NeonEmitter.cpp
Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105416&r1=105415&r2=105416&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Thu Jun 3 16:35:22 2010
@@ -41,7 +41,8 @@
OpOr,
OpXor,
OpAndNot,
- OpOrNot
+ OpOrNot,
+ OpCast
};
static void ParseTypes(Record *r, std::string &s,
@@ -85,6 +86,19 @@
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) {
unsigned off = 0;
@@ -167,6 +181,13 @@
pntr = true;
scal = true;
break;
+ case 'h':
+ type = Narrow(type);
+ break;
+ case 'e':
+ type = Narrow(type);
+ usgn = true;
+ break;
default:
break;
}
@@ -308,9 +329,11 @@
if (structTypes)
s += "(" + ts + "){";
- std::string a = structTypes ? "a.val" : "a";
- std::string b = structTypes ? "b.val" : "b";
- std::string c = structTypes ? "c.val" : "c";
+ std::string a, b, c;
+ if (proto.size() > 1)
+ a = (structTypes && proto[1] != 'l') ? "a.val" : "a";
+ b = structTypes ? "b.val" : "b";
+ c = structTypes ? "c.val" : "c";
switch(op) {
case OpAdd:
@@ -364,6 +387,9 @@
case OpOrNot:
s += a + " | ~" + b;
break;
+ case OpCast:
+ s += "(__neon_" + ts + ")" + a;
+ break;
default:
throw "unknown OpKind!";
break;
@@ -489,6 +515,7 @@
OpMap["OP_XOR"] = OpXor;
OpMap["OP_ANDN"] = OpAndNot;
OpMap["OP_ORN"] = OpOrNot;
+ OpMap["OP_CAST"] = OpCast;
// Unique the return+pattern types, and assign them.
for (unsigned i = 0, e = RV.size(); i != e; ++i) {
More information about the llvm-commits
mailing list