diff options
author | Nate Begeman <natebegeman@mac.com> | 2010-09-22 22:28:42 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2010-09-22 22:28:42 +0000 |
commit | e5cb26fab9ecc44e30cd6de462de030696b45f6d (patch) | |
tree | 39015f5488853ede4a220404ecfd98e40dc691dd | |
parent | b68987e4bff7cd269e0cb40b30851e9c2195db99 (diff) | |
download | external_llvm-e5cb26fab9ecc44e30cd6de462de030696b45f6d.zip external_llvm-e5cb26fab9ecc44e30cd6de462de030696b45f6d.tar.gz external_llvm-e5cb26fab9ecc44e30cd6de462de030696b45f6d.tar.bz2 |
<rdar://problem/8228022> Wvector-conversions warnings in arm_neon.h
Explicitly cast arguments to the type the builtin expects, which is <vN x i8>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114596 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | utils/TableGen/NeonEmitter.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/utils/TableGen/NeonEmitter.cpp b/utils/TableGen/NeonEmitter.cpp index f3707f2..310d514 100644 --- a/utils/TableGen/NeonEmitter.cpp +++ b/utils/TableGen/NeonEmitter.cpp @@ -89,7 +89,7 @@ static char Narrow(const char t) { return 'i'; case 'f': return 'h'; - default: throw "unhandled type in widen!"; + default: throw "unhandled type in narrow!"; } return '\0'; } @@ -155,6 +155,10 @@ static char ModType(const char mod, char type, bool &quad, bool &poly, case 'n': type = Widen(type); break; + case 'i': + type = 'i'; + scal = true; + break; case 'l': type = 'l'; scal = true; @@ -807,14 +811,27 @@ static std::string GenBuiltin(const std::string &name, const std::string &proto, for (unsigned i = 1, e = proto.size(); i != e; ++i, ++arg) { std::string args = std::string(&arg, 1); + bool argquad = quad; + bool scal = false; + + (void) ModType(proto[i], type, argquad, dummy, dummy, scal, dummy, dummy); + bool explicitcast = define && !scal; + if (define) args = "(" + args + ")"; + if (explicitcast) { + unsigned builtinelts = quad ? 16 : 8; + args = "(__neon_int8x" + utostr(builtinelts) + "_t)(" + args; + } // Handle multiple-vector values specially, emitting each subvector as an // argument to the __builtin. - if (structTypes && (proto[i] == '2' || proto[i] == '3' || proto[i] == '4')){ + if (structTypes && (proto[i] >= '2') && (proto[i] <= '4')) { for (unsigned vi = 0, ve = proto[i] - '0'; vi != ve; ++vi) { s += args + ".val[" + utostr(vi) + "].val"; + if (explicitcast) + s += ")"; + if ((vi + 1) < ve) s += ", "; } @@ -829,10 +846,10 @@ static std::string GenBuiltin(const std::string &name, const std::string &proto, else s += args; - if (structTypes && proto[i] != 's' && proto[i] != 'i' && proto[i] != 'l' && - proto[i] != 'p' && proto[i] != 'c' && proto[i] != 'a') { + if (structTypes && !scal) s += ".val"; - } + if (explicitcast) + s += ")"; if ((i + 1) < e) s += ", "; } |