aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMichael Gottesman <mgottesman@apple.com>2013-04-16 22:07:30 +0000
committerMichael Gottesman <mgottesman@apple.com>2013-04-16 22:07:30 +0000
commitfb599a4cc5665afe8da11d438ae021a5cd8cfdbd (patch)
tree53a60c35be941b2505525f3a5b4c70067bb56e7f /utils
parent11983018670eb6c1e02dd497f5df37117cfa28fb (diff)
[3/6] ARM Neon Intrinsic Tablegen Test Generator.
Refactored out the method InstructionTypeCode from MangleName for use in further patches which perform neon tablegen test generation. Reviewed by Bob Wilson. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/NeonEmitter.cpp72
1 files changed, 44 insertions, 28 deletions
diff --git a/utils/TableGen/NeonEmitter.cpp b/utils/TableGen/NeonEmitter.cpp
index b952f78d4b..257bf6572a 100644
--- a/utils/TableGen/NeonEmitter.cpp
+++ b/utils/TableGen/NeonEmitter.cpp
@@ -588,73 +588,89 @@ static std::string BuiltinTypeString(const char mod, StringRef typestr,
return quad ? "V16Sc" : "V8Sc";
}
-/// 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.
-static std::string MangleName(const std::string &name, StringRef typestr,
- ClassKind ck) {
- if (name == "vcvt_f32_f16")
- return name;
-
- bool quad = false;
+/// InstructionTypeCode - Computes the ARM argument character code and
+/// quad status for a specific type string and ClassKind.
+static void InstructionTypeCode(const StringRef &typeStr,
+ const ClassKind ck,
+ bool &quad,
+ std::string &typeCode) {
bool poly = false;
bool usgn = false;
- char type = ClassifyType(typestr, quad, poly, usgn);
-
- std::string s = name;
+ char type = ClassifyType(typeStr, quad, poly, usgn);
switch (type) {
case 'c':
switch (ck) {
- case ClassS: s += poly ? "_p8" : usgn ? "_u8" : "_s8"; break;
- case ClassI: s += "_i8"; break;
- case ClassW: s += "_8"; break;
+ case ClassS: typeCode = poly ? "p8" : usgn ? "u8" : "s8"; break;
+ case ClassI: typeCode = "i8"; break;
+ case ClassW: typeCode = "8"; break;
default: break;
}
break;
case 's':
switch (ck) {
- case ClassS: s += poly ? "_p16" : usgn ? "_u16" : "_s16"; break;
- case ClassI: s += "_i16"; break;
- case ClassW: s += "_16"; break;
+ case ClassS: typeCode = poly ? "p16" : usgn ? "u16" : "s16"; break;
+ case ClassI: typeCode = "i16"; break;
+ case ClassW: typeCode = "16"; break;
default: break;
}
break;
case 'i':
switch (ck) {
- case ClassS: s += usgn ? "_u32" : "_s32"; break;
- case ClassI: s += "_i32"; break;
- case ClassW: s += "_32"; break;
+ case ClassS: typeCode = usgn ? "u32" : "s32"; break;
+ case ClassI: typeCode = "i32"; break;
+ case ClassW: typeCode = "32"; break;
default: break;
}
break;
case 'l':
switch (ck) {
- case ClassS: s += usgn ? "_u64" : "_s64"; break;
- case ClassI: s += "_i64"; break;
- case ClassW: s += "_64"; break;
+ case ClassS: typeCode = usgn ? "u64" : "s64"; break;
+ case ClassI: typeCode = "i64"; break;
+ case ClassW: typeCode = "64"; break;
default: break;
}
break;
case 'h':
switch (ck) {
case ClassS:
- case ClassI: s += "_f16"; break;
- case ClassW: s += "_16"; break;
+ case ClassI: typeCode = "f16"; break;
+ case ClassW: typeCode = "16"; break;
default: break;
}
break;
case 'f':
switch (ck) {
case ClassS:
- case ClassI: s += "_f32"; break;
- case ClassW: s += "_32"; break;
+ case ClassI: typeCode = "f32"; break;
+ case ClassW: typeCode = "32"; break;
default: break;
}
break;
default:
PrintFatalError("unhandled type!");
}
+}
+
+/// 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.
+static std::string MangleName(const std::string &name, StringRef typestr,
+ ClassKind ck) {
+ if (name == "vcvt_f32_f16")
+ return name;
+
+ bool quad = false;
+ std::string typeCode = "";
+
+ InstructionTypeCode(typestr, ck, quad, typeCode);
+
+ std::string s = name;
+
+ if (typeCode.size() > 0) {
+ s += "_" + typeCode;
+ }
+
if (ck == ClassB)
s += "_v";