diff options
author | Bob Wilson <bob.wilson@apple.com> | 2010-12-15 16:58:42 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2010-12-15 16:58:42 +0000 |
commit | 06b04aaf5c01ce218dcb1450448a7ec3a28c7fdb (patch) | |
tree | fdb0c85619131e61c4c0be6c4e4000db07a2cc8d /utils | |
parent | fea3b218d61708ea3577f4ef14c8f7677a94db95 (diff) | |
download | llvm-06b04aaf5c01ce218dcb1450448a7ec3a28c7fdb.tar.gz llvm-06b04aaf5c01ce218dcb1450448a7ec3a28c7fdb.tar.bz2 llvm-06b04aaf5c01ce218dcb1450448a7ec3a28c7fdb.tar.xz |
Fix Neon intrinsic immediate range checking for some double-register operands.
Some quad-register intrinsics with lane operands only take a double-register
operand for the vector containing the lane. The valid range of lane numbers
is then half as big as you would expect from the quad-register type.
Note: This currently has no effect because those intrinsics are now handled
entirely in the header file using __builtin_shufflevector, which does its own
range checking, but I want to use this for generating tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121867 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/NeonEmitter.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/utils/TableGen/NeonEmitter.cpp b/utils/TableGen/NeonEmitter.cpp index 1d31104132..0f80d7bcdf 100644 --- a/utils/TableGen/NeonEmitter.cpp +++ b/utils/TableGen/NeonEmitter.cpp @@ -1213,10 +1213,11 @@ void NeonEmitter::emitIntrinsic(raw_ostream &OS, Record *R) { OS << "\n"; } -static unsigned RangeFromType(StringRef typestr) { +static unsigned RangeFromType(const char mod, StringRef typestr) { // base type to get the type string for. bool quad = false, dummy = false; char type = ClassifyType(typestr, quad, dummy, dummy); + type = ModType(mod, type, quad, dummy, dummy, dummy, dummy, dummy); switch (type) { case 'c': @@ -1359,7 +1360,8 @@ void NeonEmitter::runHeader(raw_ostream &OS) { // Functions which do not have an immediate do not need to have range // checking code emitted. - if (Proto.find('i') == std::string::npos) + size_t immPos = Proto.find('i'); + if (immPos == std::string::npos) continue; SmallVector<StringRef, 16> TypeVec; @@ -1386,7 +1388,9 @@ void NeonEmitter::runHeader(raw_ostream &OS) { } rangestr += "u = RFT(TV" + shiftstr + ")"; } else { - rangestr = "u = " + utostr(RangeFromType(TypeVec[ti])); + // The immediate generally refers to a lane in the preceding argument. + assert(immPos > 0 && "unexpected immediate operand"); + rangestr = "u = " + utostr(RangeFromType(Proto[immPos-1], TypeVec[ti])); } // Make sure cases appear only once by uniquing them in a string map. namestr = MangleName(name, TypeVec[ti], ck); |