1 //===- NeonEmitter.cpp - Generate arm_neon.h for use with clang -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This tablegen backend is responsible for emitting arm_neon.h, which includes
11 // a declaration and definition of each function specified by the ARM NEON
12 // compiler interface. See ARM document DUI0348B.
14 // Each NEON instruction is implemented in terms of 1 or more functions which
15 // are suffixed with the element type of the input vectors. Functions may be
16 // implemented in terms of generic vector operations such as +, *, -, etc. or
17 // by calling a __builtin_-prefixed function which will be handled by clang's
20 // Additional validation code can be generated by this file when runHeader() is
21 // called, rather than the normal run() entry point.
23 //===----------------------------------------------------------------------===//
25 #include "NeonEmitter.h"
26 #include "llvm/ADT/SmallString.h"
27 #include "llvm/ADT/SmallVector.h"
28 #include "llvm/ADT/StringExtras.h"
33 /// ParseTypes - break down a string such as "fQf" into a vector of StringRefs,
34 /// which each StringRef representing a single type declared in the string.
35 /// for "fQf" we would end up with 2 StringRefs, "f", and "Qf", representing
36 /// 2xfloat and 4xfloat respectively.
37 static void ParseTypes(Record *r, std::string &s,
38 SmallVectorImpl<StringRef> &TV) {
39 const char *data = s.data();
42 for (unsigned i = 0, e = s.size(); i != e; ++i, ++len) {
43 if (data[len] == 'P' || data[len] == 'Q' || data[len] == 'U')
55 throw TGError(r->getLoc(),
56 "Unexpected letter: " + std::string(data + len, 1));
59 TV.push_back(StringRef(data, len + 1));
65 /// Widen - Convert a type code into the next wider type. char -> short,
66 /// short -> int, etc.
67 static char Widen(const char t) {
75 default: throw "unhandled type in widen!";
80 /// Narrow - Convert a type code into the next smaller type. short -> char,
81 /// float -> half float, etc.
82 static char Narrow(const char t) {
92 default: throw "unhandled type in narrow!";
97 /// For a particular StringRef, return the base type code, and whether it has
98 /// the quad-vector, polynomial, or unsigned modifiers set.
99 static char ClassifyType(StringRef ty, bool &quad, bool &poly, bool &usgn) {
103 if (ty[off] == 'Q') {
109 if (ty[off] == 'P') {
114 // remember unsigned.
115 if (ty[off] == 'U') {
120 // base type to get the type string for.
124 /// ModType - Transform a type code and its modifiers based on a mod code. The
125 /// mod code definitions may be found at the top of arm_neon.td.
126 static char ModType(const char mod, char type, bool &quad, bool &poly,
127 bool &usgn, bool &scal, bool &cnst, bool &pntr) {
196 /// TypeString - for a modifier and type, generate the name of the typedef for
197 /// that type. QUc -> uint8x8_t.
198 static std::string TypeString(const char mod, StringRef typestr) {
211 // base type to get the type string for.
212 char type = ClassifyType(typestr, quad, poly, usgn);
214 // Based on the modifying character, change the type and width if necessary.
215 type = ModType(mod, type, quad, poly, usgn, scal, cnst, pntr);
224 s += poly ? "poly8" : "int8";
227 s += quad ? "x16" : "x8";
230 s += poly ? "poly16" : "int16";
233 s += quad ? "x8" : "x4";
239 s += quad ? "x4" : "x2";
245 s += quad ? "x2" : "x1";
251 s += quad ? "x8" : "x4";
257 s += quad ? "x4" : "x2";
260 throw "unhandled type!";
271 // Append _t, finishing the type string typedef type.
283 /// BuiltinTypeString - for a modifier and type, generate the clang
284 /// BuiltinsARM.def prototype code for the function. See the top of clang's
285 /// Builtins.def for a description of the type strings.
286 static std::string BuiltinTypeString(const char mod, StringRef typestr,
287 ClassKind ck, bool ret) {
300 // base type to get the type string for.
301 char type = ClassifyType(typestr, quad, poly, usgn);
303 // Based on the modifying character, change the type and width if necessary.
304 type = ModType(mod, type, quad, poly, usgn, scal, cnst, pntr);
306 // All pointers are void* pointers. Change type to 'v' now.
312 // Treat half-float ('h') types as unsigned short ('s') types.
317 usgn = usgn | poly | ((ck == ClassI || ck == ClassW) && scal && type != 'f');
325 if (type == 'l') // 64-bit long
337 // Since the return value must be one type, return a vector type of the
338 // appropriate width which we will bitcast. An exception is made for
339 // returning structs of 2, 3, or 4 vectors which are returned in a sret-like
340 // fashion, storing them to a pointer arg.
342 if (mod >= '2' && mod <= '4')
343 return "vv*"; // void result with void* first argument
344 if (mod == 'f' || (ck != ClassB && type == 'f'))
345 return quad ? "V4f" : "V2f";
346 if (ck != ClassB && type == 's')
347 return quad ? "V8s" : "V4s";
348 if (ck != ClassB && type == 'i')
349 return quad ? "V4i" : "V2i";
350 if (ck != ClassB && type == 'l')
351 return quad ? "V2LLi" : "V1LLi";
353 return quad ? "V16c" : "V8c";
356 // Non-return array types are passed as individual vectors.
358 return quad ? "V16cV16c" : "V8cV8c";
360 return quad ? "V16cV16cV16c" : "V8cV8cV8c";
362 return quad ? "V16cV16cV16cV16c" : "V8cV8cV8cV8c";
364 if (mod == 'f' || (ck != ClassB && type == 'f'))
365 return quad ? "V4f" : "V2f";
366 if (ck != ClassB && type == 's')
367 return quad ? "V8s" : "V4s";
368 if (ck != ClassB && type == 'i')
369 return quad ? "V4i" : "V2i";
370 if (ck != ClassB && type == 'l')
371 return quad ? "V2LLi" : "V1LLi";
373 return quad ? "V16c" : "V8c";
376 /// MangleName - Append a type or width suffix to a base neon function name,
377 /// and insert a 'q' in the appropriate location if the operation works on
378 /// 128b rather than 64b. E.g. turn "vst2_lane" into "vst2q_lane_f32", etc.
379 static std::string MangleName(const std::string &name, StringRef typestr,
381 if (name == "vcvt_f32_f16")
387 char type = ClassifyType(typestr, quad, poly, usgn);
389 std::string s = name;
394 case ClassS: s += poly ? "_p8" : usgn ? "_u8" : "_s8"; break;
395 case ClassI: s += "_i8"; break;
396 case ClassW: s += "_8"; break;
402 case ClassS: s += poly ? "_p16" : usgn ? "_u16" : "_s16"; break;
403 case ClassI: s += "_i16"; break;
404 case ClassW: s += "_16"; break;
410 case ClassS: s += usgn ? "_u32" : "_s32"; break;
411 case ClassI: s += "_i32"; break;
412 case ClassW: s += "_32"; break;
418 case ClassS: s += usgn ? "_u64" : "_s64"; break;
419 case ClassI: s += "_i64"; break;
420 case ClassW: s += "_64"; break;
427 case ClassI: s += "_f16"; break;
428 case ClassW: s += "_16"; break;
435 case ClassI: s += "_f32"; break;
436 case ClassW: s += "_32"; break;
441 throw "unhandled type!";
447 // Insert a 'q' before the first '_' character so that it ends up before
448 // _lane or _n on vector-scalar operations.
450 size_t pos = s.find('_');
451 s = s.insert(pos, "q");
456 // Generate the string "(argtype a, argtype b, ...)"
457 static std::string GenArgs(const std::string &proto, StringRef typestr) {
458 bool define = proto.find('i') != std::string::npos;
464 for (unsigned i = 1, e = proto.size(); i != e; ++i, ++arg) {
466 s += TypeString(proto[i], typestr);
478 static std::string Duplicate(unsigned nElts, StringRef typestr,
479 const std::string &a) {
482 s = "(" + TypeString('d', typestr) + "){ ";
483 for (unsigned i = 0; i != nElts; ++i) {
493 static unsigned GetNumElements(StringRef typestr, bool &quad) {
496 char type = ClassifyType(typestr, quad, dummy, dummy);
499 case 'c': nElts = 8; break;
500 case 's': nElts = 4; break;
501 case 'i': nElts = 2; break;
502 case 'l': nElts = 1; break;
503 case 'h': nElts = 4; break;
504 case 'f': nElts = 2; break;
506 throw "unhandled type!";
509 if (quad) nElts <<= 1;
513 // Generate the definition for this intrinsic, e.g. "a + b" for OpAdd.
514 static std::string GenOpString(OpKind op, const std::string &proto,
517 unsigned nElts = GetNumElements(typestr, quad);
519 std::string ts = TypeString(proto[0], typestr);
521 if (op == OpHi || op == OpLo) {
522 s = "union { " + ts + " r; double d; } u; u.d";
537 s += "a * " + Duplicate(nElts, typestr, "b");
543 s += "a + (b * " + Duplicate(nElts, typestr, "c") + ")";
549 s += "a - (b * " + Duplicate(nElts, typestr, "c") + ")";
555 s += "(" + ts + ")(a == b)";
558 s += "(" + ts + ")(a >= b)";
561 s += "(" + ts + ")(a <= b)";
564 s += "(" + ts + ")(a > b)";
567 s += "(" + ts + ")(a < b)";
591 s += "(" + ts + ")a";
594 s += "__builtin_shufflevector((int64x1_t)a";
595 s += ", (int64x1_t)b, 0, 1)";
598 s += "(((float64x2_t)a)[1])";
601 s += "(((float64x2_t)a)[0])";
604 s += Duplicate(nElts, typestr, "a");
607 // ((0 & 1) | (~0 & 2))
608 ts = TypeString(proto[1], typestr);
609 s += "(a & (" + ts + ")b) | ";
610 s += "(~a & (" + ts + ")c)";
613 s += "__builtin_shufflevector(a, a";
614 for (unsigned i = 2; i <= nElts; i += 2)
615 for (unsigned j = 0; j != 2; ++j)
616 s += ", " + utostr(i - j - 1);
620 unsigned WordElts = nElts >> (1 + (int)quad);
621 s += "__builtin_shufflevector(a, a";
622 for (unsigned i = WordElts; i <= nElts; i += WordElts)
623 for (unsigned j = 0; j != WordElts; ++j)
624 s += ", " + utostr(i - j - 1);
629 unsigned DblWordElts = nElts >> (int)quad;
630 s += "__builtin_shufflevector(a, a";
631 for (unsigned i = DblWordElts; i <= nElts; i += DblWordElts)
632 for (unsigned j = 0; j != DblWordElts; ++j)
633 s += ", " + utostr(i - j - 1);
638 throw "unknown OpKind!";
641 if (op == OpHi || op == OpLo)
642 s += "; return u.r;";
648 static unsigned GetNeonEnum(const std::string &proto, StringRef typestr) {
649 unsigned mod = proto[0];
652 if (mod == 'v' || mod == 'f')
662 // Base type to get the type string for.
663 char type = ClassifyType(typestr, quad, poly, usgn);
665 // Based on the modifying character, change the type and width if necessary.
666 type = ModType(mod, type, quad, poly, usgn, scal, cnst, pntr);
670 if (quad && proto[1] != 'g')
693 throw "unhandled type!";
699 // Generate the definition for this intrinsic, e.g. __builtin_neon_cls(a)
700 static std::string GenBuiltin(const std::string &name, const std::string &proto,
701 StringRef typestr, ClassKind ck) {
703 unsigned nElts = GetNumElements(typestr, quad);
707 // If this builtin returns a struct 2, 3, or 4 vectors, pass it as an implicit
708 // sret-like argument.
709 bool sret = (proto[0] >= '2' && proto[0] <= '4');
711 // If this builtin takes an immediate argument, we need to #define it rather
712 // than use a standard declaration, so that SemaChecking can range check
713 // the immediate passed by the user.
714 bool define = proto.find('i') != std::string::npos;
716 // Check if the prototype has a scalar operand with the type of the vector
717 // elements. If not, bitcasting the args will take care of arg checking.
718 // The actual signedness etc. will be taken care of with special enums.
719 if (proto.find('s') == std::string::npos)
722 if (proto[0] != 'v') {
723 std::string ts = TypeString(proto[0], typestr);
727 s += "({ " + ts + " r; ";
728 else if (proto[0] != 's')
733 s += ts + " r; r = ";
737 bool splat = proto.find('a') != std::string::npos;
739 s += "__builtin_neon_";
741 // Call the non-splat builtin: chop off the "_n" suffix from the name.
742 std::string vname(name, 0, name.size()-2);
743 s += MangleName(vname, typestr, ck);
745 s += MangleName(name, typestr, ck);
749 // Pass the address of the return variable as the first argument to sret-like
754 for (unsigned i = 1, e = proto.size(); i != e; ++i, ++arg) {
755 std::string args = std::string(&arg, 1);
757 // Wrap macro arguments in parenthesis.
759 args = "(" + args + ")";
761 // Handle multiple-vector values specially, emitting each subvector as an
762 // argument to the __builtin.
763 if (proto[i] >= '2' && proto[i] <= '4') {
764 for (unsigned vi = 0, ve = proto[i] - '0'; vi != ve; ++vi) {
765 s += args + ".val[" + utostr(vi) + "]";
775 if (splat && (i + 1) == e)
776 s += Duplicate(nElts, typestr, args);
783 // Extra constant integer to hold type class enum for this function, e.g. s8
785 s += ", " + utostr(GetNeonEnum(proto, typestr));
792 if (proto[0] != 'v') {
803 static std::string GenBuiltinDef(const std::string &name,
804 const std::string &proto,
805 StringRef typestr, ClassKind ck) {
806 std::string s("BUILTIN(__builtin_neon_");
808 // If all types are the same size, bitcasting the args will take care
809 // of arg checking. The actual signedness etc. will be taken care of with
811 if (proto.find('s') == std::string::npos)
814 s += MangleName(name, typestr, ck);
817 for (unsigned i = 0, e = proto.size(); i != e; ++i)
818 s += BuiltinTypeString(proto[i], typestr, ck, i == 0);
820 // Extra constant integer to hold type class enum for this function, e.g. s8
828 /// run - Read the records in arm_neon.td and output arm_neon.h. arm_neon.h
829 /// is comprised of type definitions and function declarations.
830 void NeonEmitter::run(raw_ostream &OS) {
831 EmitSourceFileHeader("ARM NEON Header", OS);
833 // FIXME: emit license into file?
835 OS << "#ifndef __ARM_NEON_H\n";
836 OS << "#define __ARM_NEON_H\n\n";
838 OS << "#ifndef __ARM_NEON__\n";
839 OS << "#error \"NEON support not enabled\"\n";
842 OS << "#include <stdint.h>\n\n";
844 // Emit NEON-specific scalar typedefs.
845 OS << "typedef float float32_t;\n";
846 OS << "typedef int8_t poly8_t;\n";
847 OS << "typedef int16_t poly16_t;\n";
848 OS << "typedef uint16_t float16_t;\n";
850 // Emit Neon vector typedefs.
851 std::string TypedefTypes("cQcsQsiQilQlUcQUcUsQUsUiQUiUlQUlhQhfQfPcQPcPsQPs");
852 SmallVector<StringRef, 24> TDTypeVec;
853 ParseTypes(0, TypedefTypes, TDTypeVec);
855 // Emit vector typedefs.
856 for (unsigned i = 0, e = TDTypeVec.size(); i != e; ++i) {
857 bool dummy, quad = false, poly = false;
858 (void) ClassifyType(TDTypeVec[i], quad, poly, dummy);
860 OS << "typedef __attribute__((neon_polyvector_type(";
862 OS << "typedef __attribute__((neon_vector_type(";
864 unsigned nElts = GetNumElements(TDTypeVec[i], quad);
865 OS << utostr(nElts) << "))) ";
869 OS << TypeString('s', TDTypeVec[i]);
870 OS << " " << TypeString('d', TDTypeVec[i]) << ";\n";
873 OS << "typedef __attribute__((__vector_size__(8))) "
874 "double float64x1_t;\n";
875 OS << "typedef __attribute__((__vector_size__(16))) "
876 "double float64x2_t;\n";
879 // Emit struct typedefs.
880 for (unsigned vi = 2; vi != 5; ++vi) {
881 for (unsigned i = 0, e = TDTypeVec.size(); i != e; ++i) {
882 std::string ts = TypeString('d', TDTypeVec[i]);
883 std::string vs = TypeString('0' + vi, TDTypeVec[i]);
884 OS << "typedef struct " << vs << " {\n";
885 OS << " " << ts << " val";
886 OS << "[" << utostr(vi) << "]";
892 OS << "#define __ai static __attribute__((__always_inline__))\n\n";
894 std::vector<Record*> RV = Records.getAllDerivedDefinitions("Inst");
896 // Unique the return+pattern types, and assign them.
897 for (unsigned i = 0, e = RV.size(); i != e; ++i) {
899 std::string name = LowercaseString(R->getName());
900 std::string Proto = R->getValueAsString("Prototype");
901 std::string Types = R->getValueAsString("Types");
903 SmallVector<StringRef, 16> TypeVec;
904 ParseTypes(R, Types, TypeVec);
906 OpKind k = OpMap[R->getValueAsDef("Operand")->getName()];
908 bool define = Proto.find('i') != std::string::npos;
910 for (unsigned ti = 0, te = TypeVec.size(); ti != te; ++ti) {
911 assert(!Proto.empty() && "");
913 // static always inline + return type
917 OS << "__ai " << TypeString(Proto[0], TypeVec[ti]);
919 // Function name with type suffix
920 OS << " " << MangleName(name, TypeVec[ti], ClassS);
922 // Function arguments
923 OS << GenArgs(Proto, TypeVec[ti]);
932 OS << GenOpString(k, Proto, TypeVec[ti]);
934 if (R->getSuperClasses().size() < 2)
935 throw TGError(R->getLoc(), "Builtin has no class kind");
937 ClassKind ck = ClassMap[R->getSuperClasses()[1]];
940 throw TGError(R->getLoc(), "Builtin has no class kind");
941 OS << GenBuiltin(name, Proto, TypeVec[ti], ck);
949 OS << "#undef __ai\n\n";
950 OS << "#endif /* __ARM_NEON_H */\n";
953 static unsigned RangeFromType(StringRef typestr) {
954 // base type to get the type string for.
955 bool quad = false, dummy = false;
956 char type = ClassifyType(typestr, quad, dummy, dummy);
960 return (8 << (int)quad) - 1;
963 return (4 << (int)quad) - 1;
966 return (2 << (int)quad) - 1;
968 return (1 << (int)quad) - 1;
970 throw "unhandled type!";
973 assert(0 && "unreachable");
977 /// runHeader - Emit a file with sections defining:
978 /// 1. the NEON section of BuiltinsARM.def.
979 /// 2. the SemaChecking code for the type overload checking.
980 /// 3. the SemaChecking code for validation of intrinsic immedate arguments.
981 void NeonEmitter::runHeader(raw_ostream &OS) {
982 std::vector<Record*> RV = Records.getAllDerivedDefinitions("Inst");
984 StringMap<OpKind> EmittedMap;
986 // Generate BuiltinsARM.def for NEON
987 OS << "#ifdef GET_NEON_BUILTINS\n";
988 for (unsigned i = 0, e = RV.size(); i != e; ++i) {
990 OpKind k = OpMap[R->getValueAsDef("Operand")->getName()];
994 std::string Proto = R->getValueAsString("Prototype");
996 // Functions with 'a' (the splat code) in the type prototype should not get
997 // their own builtin as they use the non-splat variant.
998 if (Proto.find('a') != std::string::npos)
1001 std::string Types = R->getValueAsString("Types");
1002 SmallVector<StringRef, 16> TypeVec;
1003 ParseTypes(R, Types, TypeVec);
1005 if (R->getSuperClasses().size() < 2)
1006 throw TGError(R->getLoc(), "Builtin has no class kind");
1008 std::string name = LowercaseString(R->getName());
1009 ClassKind ck = ClassMap[R->getSuperClasses()[1]];
1011 for (unsigned ti = 0, te = TypeVec.size(); ti != te; ++ti) {
1012 // Generate the BuiltinsARM.def declaration for this builtin, ensuring
1013 // that each unique BUILTIN() macro appears only once in the output
1015 std::string bd = GenBuiltinDef(name, Proto, TypeVec[ti], ck);
1016 if (EmittedMap.count(bd))
1019 EmittedMap[bd] = OpNone;
1025 // Generate the overloaded type checking code for SemaChecking.cpp
1026 OS << "#ifdef GET_NEON_OVERLOAD_CHECK\n";
1027 for (unsigned i = 0, e = RV.size(); i != e; ++i) {
1029 OpKind k = OpMap[R->getValueAsDef("Operand")->getName()];
1033 std::string Proto = R->getValueAsString("Prototype");
1034 std::string Types = R->getValueAsString("Types");
1035 std::string name = LowercaseString(R->getName());
1037 // Functions with 'a' (the splat code) in the type prototype should not get
1038 // their own builtin as they use the non-splat variant.
1039 if (Proto.find('a') != std::string::npos)
1042 // Functions which have a scalar argument cannot be overloaded, no need to
1043 // check them if we are emitting the type checking code.
1044 if (Proto.find('s') != std::string::npos)
1047 SmallVector<StringRef, 16> TypeVec;
1048 ParseTypes(R, Types, TypeVec);
1050 if (R->getSuperClasses().size() < 2)
1051 throw TGError(R->getLoc(), "Builtin has no class kind");
1053 int si = -1, qi = -1;
1054 unsigned mask = 0, qmask = 0;
1055 for (unsigned ti = 0, te = TypeVec.size(); ti != te; ++ti) {
1056 // Generate the switch case(s) for this builtin for the type validation.
1057 bool quad = false, poly = false, usgn = false;
1058 (void) ClassifyType(TypeVec[ti], quad, poly, usgn);
1062 qmask |= 1 << GetNeonEnum(Proto, TypeVec[ti]);
1065 mask |= 1 << GetNeonEnum(Proto, TypeVec[ti]);
1069 OS << "case ARM::BI__builtin_neon_"
1070 << MangleName(name, TypeVec[si], ClassB)
1071 << ": mask = " << "0x" << utohexstr(mask) << "; break;\n";
1073 OS << "case ARM::BI__builtin_neon_"
1074 << MangleName(name, TypeVec[qi], ClassB)
1075 << ": mask = " << "0x" << utohexstr(qmask) << "; break;\n";
1079 // Generate the intrinsic range checking code for shift/lane immediates.
1080 OS << "#ifdef GET_NEON_IMMEDIATE_CHECK\n";
1081 for (unsigned i = 0, e = RV.size(); i != e; ++i) {
1084 OpKind k = OpMap[R->getValueAsDef("Operand")->getName()];
1088 std::string name = LowercaseString(R->getName());
1089 std::string Proto = R->getValueAsString("Prototype");
1090 std::string Types = R->getValueAsString("Types");
1092 // Functions with 'a' (the splat code) in the type prototype should not get
1093 // their own builtin as they use the non-splat variant.
1094 if (Proto.find('a') != std::string::npos)
1097 // Functions which do not have an immediate do not need to have range
1098 // checking code emitted.
1099 if (Proto.find('i') == std::string::npos)
1102 SmallVector<StringRef, 16> TypeVec;
1103 ParseTypes(R, Types, TypeVec);
1105 if (R->getSuperClasses().size() < 2)
1106 throw TGError(R->getLoc(), "Builtin has no class kind");
1108 ClassKind ck = ClassMap[R->getSuperClasses()[1]];
1110 for (unsigned ti = 0, te = TypeVec.size(); ti != te; ++ti) {
1111 std::string namestr, shiftstr, rangestr;
1113 // Builtins which are overloaded by type will need to have their upper
1114 // bound computed at Sema time based on the type constant.
1115 if (Proto.find('s') == std::string::npos) {
1117 if (R->getValueAsBit("isShift")) {
1118 shiftstr = ", true";
1120 // Right shifts have an 'r' in the name, left shifts do not.
1121 if (name.find('r') != std::string::npos)
1122 rangestr = "l = 1; ";
1124 rangestr += "u = RFT(TV" + shiftstr + ")";
1126 rangestr = "u = " + utostr(RangeFromType(TypeVec[ti]));
1128 // Make sure cases appear only once by uniquing them in a string map.
1129 namestr = MangleName(name, TypeVec[ti], ck);
1130 if (EmittedMap.count(namestr))
1132 EmittedMap[namestr] = OpNone;
1134 // Calculate the index of the immediate that should be range checked.
1135 unsigned immidx = 0;
1137 // Builtins that return a struct of multiple vectors have an extra
1138 // leading arg for the struct return.
1139 if (Proto[0] >= '2' && Proto[0] <= '4')
1142 // Add one to the index for each argument until we reach the immediate
1143 // to be checked. Structs of vectors are passed as multiple arguments.
1144 for (unsigned ii = 1, ie = Proto.size(); ii != ie; ++ii) {
1145 switch (Proto[ii]) {
1146 default: immidx += 1; break;
1147 case '2': immidx += 2; break;
1148 case '3': immidx += 3; break;
1149 case '4': immidx += 4; break;
1150 case 'i': ie = ii + 1; break;
1153 OS << "case ARM::BI__builtin_neon_" << MangleName(name, TypeVec[ti], ck)
1154 << ": i = " << immidx << "; " << rangestr << "; break;\n";