[llvm-commits] [llvm] r119369 - /llvm/trunk/utils/TableGen/NeonEmitter.cpp
Bob Wilson
bob.wilson at apple.com
Tue Nov 16 11:39:14 PST 2010
Author: bwilson
Date: Tue Nov 16 13:39:14 2010
New Revision: 119369
URL: http://llvm.org/viewvc/llvm-project?rev=119369&view=rev
Log:
Tidy up some things in <arm_neon.h>.
Stop defining types with "__neon_" prefixes and then using typedefs without
the prefix; there's no reason to do that anymore. Remove types that combine
multiple Neon vectors and treat them as a single long vector; they are not
used.
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=119369&r1=119368&r2=119369&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Tue Nov 16 13:39:14 2010
@@ -189,10 +189,8 @@
}
/// TypeString - for a modifier and type, generate the name of the typedef for
-/// that type. If generic is true, emit the generic vector type rather than
-/// the public NEON type. QUc -> uint8x8_t / __neon_uint8x8_t.
-static std::string TypeString(const char mod, StringRef typestr,
- bool generic = false) {
+/// that type. QUc -> uint8x8_t.
+static std::string TypeString(const char mod, StringRef typestr) {
bool quad = false;
bool poly = false;
bool usgn = false;
@@ -213,9 +211,6 @@
SmallString<128> s;
- if (generic)
- s += "__neon_";
-
if (usgn)
s.push_back('u');
@@ -371,52 +366,6 @@
return quad ? "V16c" : "V8c";
}
-/// StructTag - generate the name of the struct tag for a type.
-/// These names are mandated by ARM's ABI.
-static std::string StructTag(StringRef typestr) {
- bool quad = false;
- bool poly = false;
- bool usgn = false;
-
- // base type to get the type string for.
- char type = ClassifyType(typestr, quad, poly, usgn);
-
- SmallString<128> s;
- s += "__simd";
- s += quad ? "128_" : "64_";
- if (usgn)
- s.push_back('u');
-
- switch (type) {
- case 'c':
- s += poly ? "poly8" : "int8";
- break;
- case 's':
- s += poly ? "poly16" : "int16";
- break;
- case 'i':
- s += "int32";
- break;
- case 'l':
- s += "int64";
- break;
- case 'h':
- s += "float16";
- break;
- case 'f':
- s += "float32";
- break;
- default:
- throw "unhandled type!";
- break;
- }
-
- // Append _t, finishing the struct tag name.
- s += "_t";
-
- return s.str();
-}
-
/// MangleName - Append a type or width suffix to a base neon function name,
/// and insert a 'q' in the appropriate location if the operation works on
/// 128b rather than 64b. E.g. turn "vst2_lane" into "vst2q_lane_f32", etc.
@@ -523,7 +472,7 @@
const std::string &a) {
std::string s;
- s = "(__neon_" + TypeString('d', typestr) + "){ ";
+ s = "(" + TypeString('d', typestr) + "){ ";
for (unsigned i = 0; i != nElts; ++i) {
s += a;
if ((i + 1) < nElts)
@@ -585,19 +534,19 @@
s += "a - (b * c)";
break;
case OpEq:
- s += "(__neon_" + ts + ")(a == b)";
+ s += "(" + ts + ")(a == b)";
break;
case OpGe:
- s += "(__neon_" + ts + ")(a >= b)";
+ s += "(" + ts + ")(a >= b)";
break;
case OpLe:
- s += "(__neon_" + ts + ")(a <= b)";
+ s += "(" + ts + ")(a <= b)";
break;
case OpGt:
- s += "(__neon_" + ts + ")(a > b)";
+ s += "(" + ts + ")(a > b)";
break;
case OpLt:
- s += "(__neon_" + ts + ")(a < b)";
+ s += "(" + ts + ")(a < b)";
break;
case OpNeg:
s += " -a";
@@ -621,17 +570,17 @@
s += "a | ~b";
break;
case OpCast:
- s += "(__neon_" + ts + ")a";
+ s += "(" + ts + ")a";
break;
case OpConcat:
- s += "__builtin_shufflevector((__neon_int64x1_t)a";
- s += ", (__neon_int64x1_t)b, 0, 1)";
+ s += "__builtin_shufflevector((int64x1_t)a";
+ s += ", (int64x1_t)b, 0, 1)";
break;
case OpHi:
- s += "(((__neon_float64x2_t)a)[1])";
+ s += "(((float64x2_t)a)[1])";
break;
case OpLo:
- s += "(((__neon_float64x2_t)a)[0])";
+ s += "(((float64x2_t)a)[0])";
break;
case OpDup:
s += Duplicate(nElts << (int)quad, typestr, "a");
@@ -639,8 +588,8 @@
case OpSelect:
// ((0 & 1) | (~0 & 2))
ts = TypeString(proto[1], typestr);
- s += "(a & (__neon_" + ts + ")b) | ";
- s += "(~a & (__neon_" + ts + ")c)";
+ s += "(a & (" + ts + ")b) | ";
+ s += "(~a & (" + ts + ")c)";
break;
case OpRev16:
s += "__builtin_shufflevector(a, a";
@@ -891,44 +840,34 @@
ParseTypes(0, TypedefTypes, TDTypeVec);
// Emit vector typedefs.
- for (unsigned v = 1; v != 5; ++v) {
- for (unsigned i = 0, e = TDTypeVec.size(); i != e; ++i) {
- bool dummy, quad = false;
- (void) ClassifyType(TDTypeVec[i], quad, dummy, dummy);
- OS << "typedef __attribute__(( __vector_size__(";
+ for (unsigned i = 0, e = TDTypeVec.size(); i != e; ++i) {
+ bool dummy, quad = false;
+ (void) ClassifyType(TDTypeVec[i], quad, dummy, dummy);
+ OS << "typedef __attribute__(( __vector_size__(";
+
+ OS << utostr(8*(quad ? 2 : 1)) << ") )) ";
+ if (!quad)
+ OS << " ";
- OS << utostr(8*v*(quad ? 2 : 1)) << ") )) ";
- if (!quad && v == 1)
- OS << " ";
-
- OS << TypeString('s', TDTypeVec[i]);
- OS << " __neon_";
-
- char t = (v == 1) ? 'd' : '0' + v;
- OS << TypeString(t, TDTypeVec[i]) << ";\n";
- }
+ OS << TypeString('s', TDTypeVec[i]);
+ OS << " " << TypeString('d', TDTypeVec[i]) << ";\n";
}
OS << "\n";
OS << "typedef __attribute__(( __vector_size__(8) )) "
- "double __neon_float64x1_t;\n";
+ "double float64x1_t;\n";
OS << "typedef __attribute__(( __vector_size__(16) )) "
- "double __neon_float64x2_t;\n";
+ "double float64x2_t;\n";
OS << "\n";
// Emit struct typedefs.
- for (unsigned vi = 1; vi != 5; ++vi) {
+ for (unsigned vi = 2; vi != 5; ++vi) {
for (unsigned i = 0, e = TDTypeVec.size(); i != e; ++i) {
- std::string ts = TypeString('d', TDTypeVec[i], vi == 1);
- std::string vs = TypeString((vi > 1) ? '0' + vi : 'd', TDTypeVec[i]);
- std::string tag = (vi > 1) ? vs : StructTag(TDTypeVec[i]);
- if (vi > 1) {
- OS << "typedef struct " << tag << " {\n";
- OS << " " << ts << " val";
- OS << "[" << utostr(vi) << "]";
- OS << ";\n} ";
- } else {
- OS << "typedef " << ts << " ";
- }
+ std::string ts = TypeString('d', TDTypeVec[i]);
+ std::string vs = TypeString('0' + vi, TDTypeVec[i]);
+ OS << "typedef struct " << vs << " {\n";
+ OS << " " << ts << " val";
+ OS << "[" << utostr(vi) << "]";
+ OS << ";\n} ";
OS << vs << ";\n\n";
}
}
More information about the llvm-commits
mailing list