CGBuiltin.cpp revision 8b418685e9e4f02f4eb2a76e1ec063e07552b68d
1022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson//===---- CGBuiltin.cpp - Emit LLVM Code for builtins ---------------------===//
2022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson//
3022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson//                     The LLVM Compiler Infrastructure
4022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson//
50bc735ffcfb223c0186419547abaa5c84482663eChris Lattner// This file is distributed under the University of Illinois Open Source
60bc735ffcfb223c0186419547abaa5c84482663eChris Lattner// License. See LICENSE.TXT for details.
7022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson//
8022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson//===----------------------------------------------------------------------===//
9022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson//
10022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson// This contains code to emit Builtin calls as LLVM code.
11022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson//
12022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson//===----------------------------------------------------------------------===//
13022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson
14d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall#include "TargetInfo.h"
15022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson#include "CodeGenFunction.h"
16022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson#include "CodeGenModule.h"
1755bcace250e1ff366e4482714b344b8cbc8be5f3Fariborz Jahanian#include "CGObjCRuntime.h"
18ca6fcfad547dcec3fdd17790b4fab0918df74b37Anders Carlsson#include "clang/Basic/TargetInfo.h"
19bef20ac367a09555b30d6eb3847a81ec164caf88Chris Lattner#include "clang/AST/ASTContext.h"
20c4a1dea2dc56bd1357ec91b829a0b9e68229a13eDaniel Dunbar#include "clang/AST/Decl.h"
216b15cdc1312f8fc45c86ee75e2a85106700e97f6Chris Lattner#include "clang/Basic/TargetBuiltins.h"
22793680ed8104bf088d1b382b963a8badcb3f07deAnders Carlsson#include "llvm/Intrinsics.h"
23d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall#include "llvm/Target/TargetData.h"
24558229f267d2cdee69639df04382082e7c7ad54cJakub Staszak
25022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlssonusing namespace clang;
26022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlssonusing namespace CodeGen;
27ca6fcfad547dcec3fdd17790b4fab0918df74b37Anders Carlssonusing namespace llvm;
28ca6fcfad547dcec3fdd17790b4fab0918df74b37Anders Carlsson
29a45680b7e7c49ea9893c6cff585984f3e4120366John McCall/// getBuiltinLibFunction - Given a builtin id for a function like
30a45680b7e7c49ea9893c6cff585984f3e4120366John McCall/// "__builtin_fabsf", return a Function* for "fabsf".
31a45680b7e7c49ea9893c6cff585984f3e4120366John McCallllvm::Value *CodeGenModule::getBuiltinLibFunction(const FunctionDecl *FD,
32a45680b7e7c49ea9893c6cff585984f3e4120366John McCall                                                  unsigned BuiltinID) {
33a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  assert(Context.BuiltinInfo.isLibFunction(BuiltinID));
34a45680b7e7c49ea9893c6cff585984f3e4120366John McCall
35a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  // Get the name, skip over the __builtin_ prefix (if necessary).
36a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  StringRef Name;
37a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  GlobalDecl D(FD);
38a45680b7e7c49ea9893c6cff585984f3e4120366John McCall
39a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  // If the builtin has been declared explicitly with an assembler label,
40a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  // use the mangled name. This differs from the plain label on platforms
41a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  // that prefix labels.
42a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  if (FD->hasAttr<AsmLabelAttr>())
43a45680b7e7c49ea9893c6cff585984f3e4120366John McCall    Name = getMangledName(D);
44a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  else
45a45680b7e7c49ea9893c6cff585984f3e4120366John McCall    Name = Context.BuiltinInfo.GetName(BuiltinID) + 10;
46a45680b7e7c49ea9893c6cff585984f3e4120366John McCall
47a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  llvm::FunctionType *Ty =
48a45680b7e7c49ea9893c6cff585984f3e4120366John McCall    cast<llvm::FunctionType>(getTypes().ConvertType(FD->getType()));
49a45680b7e7c49ea9893c6cff585984f3e4120366John McCall
50a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  return GetOrCreateLLVMFunction(Name, Ty, D, /*ForVTable=*/false);
51a45680b7e7c49ea9893c6cff585984f3e4120366John McCall}
52a45680b7e7c49ea9893c6cff585984f3e4120366John McCall
5326815d97c5743481e317f17a8d53a6819d061862John McCall/// Emit the conversions required to turn the given value into an
5426815d97c5743481e317f17a8d53a6819d061862John McCall/// integer of the given size.
5526815d97c5743481e317f17a8d53a6819d061862John McCallstatic Value *EmitToInt(CodeGenFunction &CGF, llvm::Value *V,
562acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner                        QualType T, llvm::IntegerType *IntType) {
5726815d97c5743481e317f17a8d53a6819d061862John McCall  V = CGF.EmitToMemory(V, T);
5826815d97c5743481e317f17a8d53a6819d061862John McCall
5926815d97c5743481e317f17a8d53a6819d061862John McCall  if (V->getType()->isPointerTy())
6026815d97c5743481e317f17a8d53a6819d061862John McCall    return CGF.Builder.CreatePtrToInt(V, IntType);
6126815d97c5743481e317f17a8d53a6819d061862John McCall
6226815d97c5743481e317f17a8d53a6819d061862John McCall  assert(V->getType() == IntType);
6326815d97c5743481e317f17a8d53a6819d061862John McCall  return V;
64db4325b098eff5e9e660db19f0148423fb21f27fChandler Carruth}
65db4325b098eff5e9e660db19f0148423fb21f27fChandler Carruth
6626815d97c5743481e317f17a8d53a6819d061862John McCallstatic Value *EmitFromInt(CodeGenFunction &CGF, llvm::Value *V,
672acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner                          QualType T, llvm::Type *ResultType) {
6826815d97c5743481e317f17a8d53a6819d061862John McCall  V = CGF.EmitFromMemory(V, T);
6926815d97c5743481e317f17a8d53a6819d061862John McCall
7026815d97c5743481e317f17a8d53a6819d061862John McCall  if (ResultType->isPointerTy())
7126815d97c5743481e317f17a8d53a6819d061862John McCall    return CGF.Builder.CreateIntToPtr(V, ResultType);
7226815d97c5743481e317f17a8d53a6819d061862John McCall
7326815d97c5743481e317f17a8d53a6819d061862John McCall  assert(V->getType() == ResultType);
7426815d97c5743481e317f17a8d53a6819d061862John McCall  return V;
75db4325b098eff5e9e660db19f0148423fb21f27fChandler Carruth}
76db4325b098eff5e9e660db19f0148423fb21f27fChandler Carruth
770002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar/// Utility to insert an atomic instruction based on Instrinsic::ID
780002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar/// and the expression node.
79cb61a7bbe635cfa941b1aeaaa1fbda1bf900ee51Daniel Dunbarstatic RValue EmitBinaryAtomic(CodeGenFunction &CGF,
80c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman                               llvm::AtomicRMWInst::BinOp Kind,
81c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman                               const CallExpr *E) {
8226815d97c5743481e317f17a8d53a6819d061862John McCall  QualType T = E->getType();
8326815d97c5743481e317f17a8d53a6819d061862John McCall  assert(E->getArg(0)->getType()->isPointerType());
8426815d97c5743481e317f17a8d53a6819d061862John McCall  assert(CGF.getContext().hasSameUnqualifiedType(T,
8526815d97c5743481e317f17a8d53a6819d061862John McCall                                  E->getArg(0)->getType()->getPointeeType()));
8626815d97c5743481e317f17a8d53a6819d061862John McCall  assert(CGF.getContext().hasSameUnqualifiedType(T, E->getArg(1)->getType()));
8726815d97c5743481e317f17a8d53a6819d061862John McCall
884f209445c06a43283c6f72dda7c925538b1578e9Chris Lattner  llvm::Value *DestPtr = CGF.EmitScalarExpr(E->getArg(0));
894f209445c06a43283c6f72dda7c925538b1578e9Chris Lattner  unsigned AddrSpace =
904f209445c06a43283c6f72dda7c925538b1578e9Chris Lattner    cast<llvm::PointerType>(DestPtr->getType())->getAddressSpace();
9126815d97c5743481e317f17a8d53a6819d061862John McCall
929cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner  llvm::IntegerType *IntType =
93db4325b098eff5e9e660db19f0148423fb21f27fChandler Carruth    llvm::IntegerType::get(CGF.getLLVMContext(),
9426815d97c5743481e317f17a8d53a6819d061862John McCall                           CGF.getContext().getTypeSize(T));
959cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner  llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
9626815d97c5743481e317f17a8d53a6819d061862John McCall
9726815d97c5743481e317f17a8d53a6819d061862John McCall  llvm::Value *Args[2];
9826815d97c5743481e317f17a8d53a6819d061862John McCall  Args[0] = CGF.Builder.CreateBitCast(DestPtr, IntPtrType);
9926815d97c5743481e317f17a8d53a6819d061862John McCall  Args[1] = CGF.EmitScalarExpr(E->getArg(1));
1002acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner  llvm::Type *ValueType = Args[1]->getType();
10126815d97c5743481e317f17a8d53a6819d061862John McCall  Args[1] = EmitToInt(CGF, Args[1], T, IntType);
10226815d97c5743481e317f17a8d53a6819d061862John McCall
103c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman  llvm::Value *Result =
104c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman      CGF.Builder.CreateAtomicRMW(Kind, Args[0], Args[1],
105c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman                                  llvm::SequentiallyConsistent);
10626815d97c5743481e317f17a8d53a6819d061862John McCall  Result = EmitFromInt(CGF, Result, T, ValueType);
10726815d97c5743481e317f17a8d53a6819d061862John McCall  return RValue::get(Result);
1080002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar}
1090002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar
1100002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar/// Utility to insert an atomic instruction based Instrinsic::ID and
11126815d97c5743481e317f17a8d53a6819d061862John McCall/// the expression node, where the return value is the result of the
11226815d97c5743481e317f17a8d53a6819d061862John McCall/// operation.
113420b11850d3f4557421f43f519b59d528329c668Chris Lattnerstatic RValue EmitBinaryAtomicPost(CodeGenFunction &CGF,
114c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman                                   llvm::AtomicRMWInst::BinOp Kind,
115c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman                                   const CallExpr *E,
1160002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar                                   Instruction::BinaryOps Op) {
11726815d97c5743481e317f17a8d53a6819d061862John McCall  QualType T = E->getType();
11826815d97c5743481e317f17a8d53a6819d061862John McCall  assert(E->getArg(0)->getType()->isPointerType());
11926815d97c5743481e317f17a8d53a6819d061862John McCall  assert(CGF.getContext().hasSameUnqualifiedType(T,
12026815d97c5743481e317f17a8d53a6819d061862John McCall                                  E->getArg(0)->getType()->getPointeeType()));
12126815d97c5743481e317f17a8d53a6819d061862John McCall  assert(CGF.getContext().hasSameUnqualifiedType(T, E->getArg(1)->getType()));
12226815d97c5743481e317f17a8d53a6819d061862John McCall
1234f209445c06a43283c6f72dda7c925538b1578e9Chris Lattner  llvm::Value *DestPtr = CGF.EmitScalarExpr(E->getArg(0));
1244f209445c06a43283c6f72dda7c925538b1578e9Chris Lattner  unsigned AddrSpace =
1254f209445c06a43283c6f72dda7c925538b1578e9Chris Lattner    cast<llvm::PointerType>(DestPtr->getType())->getAddressSpace();
12626815d97c5743481e317f17a8d53a6819d061862John McCall
1279cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner  llvm::IntegerType *IntType =
128db4325b098eff5e9e660db19f0148423fb21f27fChandler Carruth    llvm::IntegerType::get(CGF.getLLVMContext(),
12926815d97c5743481e317f17a8d53a6819d061862John McCall                           CGF.getContext().getTypeSize(T));
1309cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner  llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
13126815d97c5743481e317f17a8d53a6819d061862John McCall
13226815d97c5743481e317f17a8d53a6819d061862John McCall  llvm::Value *Args[2];
13326815d97c5743481e317f17a8d53a6819d061862John McCall  Args[1] = CGF.EmitScalarExpr(E->getArg(1));
1342acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner  llvm::Type *ValueType = Args[1]->getType();
13526815d97c5743481e317f17a8d53a6819d061862John McCall  Args[1] = EmitToInt(CGF, Args[1], T, IntType);
13626815d97c5743481e317f17a8d53a6819d061862John McCall  Args[0] = CGF.Builder.CreateBitCast(DestPtr, IntPtrType);
13726815d97c5743481e317f17a8d53a6819d061862John McCall
138c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman  llvm::Value *Result =
139c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman      CGF.Builder.CreateAtomicRMW(Kind, Args[0], Args[1],
140c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman                                  llvm::SequentiallyConsistent);
14126815d97c5743481e317f17a8d53a6819d061862John McCall  Result = CGF.Builder.CreateBinOp(Op, Result, Args[1]);
14226815d97c5743481e317f17a8d53a6819d061862John McCall  Result = EmitFromInt(CGF, Result, T, ValueType);
14326815d97c5743481e317f17a8d53a6819d061862John McCall  return RValue::get(Result);
1441ffe281890f3cd7728316b45a1f3dd4d3120af7bMon P Wang}
1451ffe281890f3cd7728316b45a1f3dd4d3120af7bMon P Wang
146420b11850d3f4557421f43f519b59d528329c668Chris Lattner/// EmitFAbs - Emit a call to fabs/fabsf/fabsl, depending on the type of ValTy,
147420b11850d3f4557421f43f519b59d528329c668Chris Lattner/// which must be a scalar floating point type.
148420b11850d3f4557421f43f519b59d528329c668Chris Lattnerstatic Value *EmitFAbs(CodeGenFunction &CGF, Value *V, QualType ValTy) {
149420b11850d3f4557421f43f519b59d528329c668Chris Lattner  const BuiltinType *ValTyP = ValTy->getAs<BuiltinType>();
150420b11850d3f4557421f43f519b59d528329c668Chris Lattner  assert(ValTyP && "isn't scalar fp type!");
151420b11850d3f4557421f43f519b59d528329c668Chris Lattner
152420b11850d3f4557421f43f519b59d528329c668Chris Lattner  StringRef FnName;
153420b11850d3f4557421f43f519b59d528329c668Chris Lattner  switch (ValTyP->getKind()) {
154b219cfc4d75f0a03630b7c4509ef791b7e97b2c8David Blaikie  default: llvm_unreachable("Isn't a scalar fp type!");
155420b11850d3f4557421f43f519b59d528329c668Chris Lattner  case BuiltinType::Float:      FnName = "fabsf"; break;
156420b11850d3f4557421f43f519b59d528329c668Chris Lattner  case BuiltinType::Double:     FnName = "fabs"; break;
157420b11850d3f4557421f43f519b59d528329c668Chris Lattner  case BuiltinType::LongDouble: FnName = "fabsl"; break;
158420b11850d3f4557421f43f519b59d528329c668Chris Lattner  }
159420b11850d3f4557421f43f519b59d528329c668Chris Lattner
160420b11850d3f4557421f43f519b59d528329c668Chris Lattner  // The prototype is something that takes and returns whatever V's type is.
161da549e8995c447542d5631b8b67fcc3a9582797aJay Foad  llvm::FunctionType *FT = llvm::FunctionType::get(V->getType(), V->getType(),
16295d318c4c10437db40ca6e15fdf32e04012da58eBenjamin Kramer                                                   false);
163420b11850d3f4557421f43f519b59d528329c668Chris Lattner  llvm::Value *Fn = CGF.CGM.CreateRuntimeFunction(FT, FnName);
164420b11850d3f4557421f43f519b59d528329c668Chris Lattner
165420b11850d3f4557421f43f519b59d528329c668Chris Lattner  return CGF.Builder.CreateCall(Fn, V, "abs");
166420b11850d3f4557421f43f519b59d528329c668Chris Lattner}
167420b11850d3f4557421f43f519b59d528329c668Chris Lattner
168a45680b7e7c49ea9893c6cff585984f3e4120366John McCallstatic RValue emitLibraryCall(CodeGenFunction &CGF, const FunctionDecl *Fn,
169a45680b7e7c49ea9893c6cff585984f3e4120366John McCall                              const CallExpr *E, llvm::Value *calleeValue) {
170a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  return CGF.EmitCall(E->getCallee()->getType(), calleeValue,
171a45680b7e7c49ea9893c6cff585984f3e4120366John McCall                      ReturnValueSlot(), E->arg_begin(), E->arg_end(), Fn);
172a45680b7e7c49ea9893c6cff585984f3e4120366John McCall}
173a45680b7e7c49ea9893c6cff585984f3e4120366John McCall
1741eb4433ac451dc16f4133a88af2d002ac26c58efMike StumpRValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
175ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar                                        unsigned BuiltinID, const CallExpr *E) {
176564ea2a99b3afeac9ded332730a56db1f6358a58Chris Lattner  // See if we can constant fold this builtin.  If so, don't emit it at all.
177f35d35a2316dcb65d078844696c2032b71a7f103Anders Carlsson  Expr::EvalResult Result;
17852a27f5be98d99fd5339949d8a3d0b2aec655e0bEli Friedman  if (E->EvaluateAsRValue(Result, CGM.getContext()) &&
179dd697bc8629f0fa6777245610d52ca7ceb3b67f4Fariborz Jahanian      !Result.hasSideEffects()) {
180f35d35a2316dcb65d078844696c2032b71a7f103Anders Carlsson    if (Result.Val.isInt())
181d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall      return RValue::get(llvm::ConstantInt::get(getLLVMContext(),
1824a28d5deeba33722aa009eab488591fb9055cc7eOwen Anderson                                                Result.Val.getInt()));
183a1aa9e36e6e21f74c56cf9e72cb5bd9aa2a92fd4Chris Lattner    if (Result.Val.isFloat())
184d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall      return RValue::get(llvm::ConstantFP::get(getLLVMContext(),
185d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall                                               Result.Val.getFloat()));
1861f32999ec79a980576e100d64d5f3267eb19ea49Chris Lattner  }
1871eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
188564ea2a99b3afeac9ded332730a56db1f6358a58Chris Lattner  switch (BuiltinID) {
189564ea2a99b3afeac9ded332730a56db1f6358a58Chris Lattner  default: break;  // Handle intrinsics and libm functions below.
190506ff88f44562df267b6a06608ab841b76df2a2bChris Lattner  case Builtin::BI__builtin___CFStringMakeConstantString:
1910d13f6fdbdd6f06e2449b8834dda53334abd399aDavid Chisnall  case Builtin::BI__builtin___NSStringMakeConstantString:
192e9352cc9818ba59e7cf88500ef048991c90f3821Anders Carlsson    return RValue::get(CGM.EmitConstantExpr(E, E->getType(), 0));
1936a705f0443f8398ece14d80e71d8e8c9e71aa84aChris Lattner  case Builtin::BI__builtin_stdarg_start:
194793680ed8104bf088d1b382b963a8badcb3f07deAnders Carlsson  case Builtin::BI__builtin_va_start:
195793680ed8104bf088d1b382b963a8badcb3f07deAnders Carlsson  case Builtin::BI__builtin_va_end: {
1960785570af3ef5f8c5a0377129e41efe6f3f8d770Daniel Dunbar    Value *ArgValue = EmitVAListRef(E->getArg(0));
1972acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *DestType = Int8PtrTy;
198793680ed8104bf088d1b382b963a8badcb3f07deAnders Carlsson    if (ArgValue->getType() != DestType)
1991eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump      ArgValue = Builder.CreateBitCast(ArgValue, DestType,
200b27ffbef8e8aa1e87b63cbc0d9cd630aba30dae5Daniel Dunbar                                       ArgValue->getName().data());
201793680ed8104bf088d1b382b963a8badcb3f07deAnders Carlsson
2021eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    Intrinsic::ID inst = (BuiltinID == Builtin::BI__builtin_va_end) ?
2036a705f0443f8398ece14d80e71d8e8c9e71aa84aChris Lattner      Intrinsic::vaend : Intrinsic::vastart;
2047acda7c4a0e4aec6c003b3169ca45a5f3bc7e033Chris Lattner    return RValue::get(Builder.CreateCall(CGM.getIntrinsic(inst), ArgValue));
205793680ed8104bf088d1b382b963a8badcb3f07deAnders Carlsson  }
206a28ef8b5c6ea452472d89041128fac8b683fe968Anders Carlsson  case Builtin::BI__builtin_va_copy: {
2074fd0aa5803357d8c72eeac2cae15e12649ea08feEli Friedman    Value *DstPtr = EmitVAListRef(E->getArg(0));
2084fd0aa5803357d8c72eeac2cae15e12649ea08feEli Friedman    Value *SrcPtr = EmitVAListRef(E->getArg(1));
209a28ef8b5c6ea452472d89041128fac8b683fe968Anders Carlsson
2102acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *Type = Int8PtrTy;
211a28ef8b5c6ea452472d89041128fac8b683fe968Anders Carlsson
212a28ef8b5c6ea452472d89041128fac8b683fe968Anders Carlsson    DstPtr = Builder.CreateBitCast(DstPtr, Type);
213a28ef8b5c6ea452472d89041128fac8b683fe968Anders Carlsson    SrcPtr = Builder.CreateBitCast(SrcPtr, Type);
2141eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    return RValue::get(Builder.CreateCall2(CGM.getIntrinsic(Intrinsic::vacopy),
2153eae03e7d165f20a863a9a4d7122ba2a691ab16dChris Lattner                                           DstPtr, SrcPtr));
216a28ef8b5c6ea452472d89041128fac8b683fe968Anders Carlsson  }
217f7b2d8b3b1971e73e2d2f0662520dc7693235a7fEli Friedman  case Builtin::BI__builtin_abs:
218f7b2d8b3b1971e73e2d2f0662520dc7693235a7fEli Friedman  case Builtin::BI__builtin_labs:
219f7b2d8b3b1971e73e2d2f0662520dc7693235a7fEli Friedman  case Builtin::BI__builtin_llabs: {
2201eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    Value *ArgValue = EmitScalarExpr(E->getArg(0));
2211eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2229a847f598c4907a72b8593b364b9e6b94b086e75Chris Lattner    Value *NegOp = Builder.CreateNeg(ArgValue, "neg");
2231eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    Value *CmpResult =
2241eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    Builder.CreateICmpSGE(ArgValue,
225c9c88b4159791c48e486ca94e3743b5979e2b7a6Owen Anderson                          llvm::Constant::getNullValue(ArgValue->getType()),
2269a847f598c4907a72b8593b364b9e6b94b086e75Chris Lattner                                                            "abscond");
2271eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    Value *Result =
228c2251dc59b0edc28f9303637dec970a7520939adAnders Carlsson      Builder.CreateSelect(CmpResult, ArgValue, NegOp, "abs");
2291eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
230c2251dc59b0edc28f9303637dec970a7520939adAnders Carlsson    return RValue::get(Result);
231c2251dc59b0edc28f9303637dec970a7520939adAnders Carlsson  }
232a49a2839266f0bac2b6286e9f49fdc0c292938feBenjamin Kramer  case Builtin::BI__builtin_ctzs:
2333a31d60cffedfb7c9e6d129a5c9ba15fa74f179aAnders Carlsson  case Builtin::BI__builtin_ctz:
2343a31d60cffedfb7c9e6d129a5c9ba15fa74f179aAnders Carlsson  case Builtin::BI__builtin_ctzl:
2353a31d60cffedfb7c9e6d129a5c9ba15fa74f179aAnders Carlsson  case Builtin::BI__builtin_ctzll: {
2363a31d60cffedfb7c9e6d129a5c9ba15fa74f179aAnders Carlsson    Value *ArgValue = EmitScalarExpr(E->getArg(0));
2371eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2389cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *ArgType = ArgValue->getType();
2398dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::cttz, ArgType);
2403a31d60cffedfb7c9e6d129a5c9ba15fa74f179aAnders Carlsson
2412acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *ResultType = ConvertType(E->getType());
2428b30a9379f730875ba8fb2d0fe2d43611e0c20ffBob Wilson    Value *ZeroUndef = Builder.getInt1(Target.isCLZForZeroUndef());
2438b30a9379f730875ba8fb2d0fe2d43611e0c20ffBob Wilson    Value *Result = Builder.CreateCall2(F, ArgValue, ZeroUndef);
2443a31d60cffedfb7c9e6d129a5c9ba15fa74f179aAnders Carlsson    if (Result->getType() != ResultType)
245eac73e5b3eb3862945bcaa2770c71a727a3ee542Duncan Sands      Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
246eac73e5b3eb3862945bcaa2770c71a727a3ee542Duncan Sands                                     "cast");
2473a31d60cffedfb7c9e6d129a5c9ba15fa74f179aAnders Carlsson    return RValue::get(Result);
2483a31d60cffedfb7c9e6d129a5c9ba15fa74f179aAnders Carlsson  }
249a49a2839266f0bac2b6286e9f49fdc0c292938feBenjamin Kramer  case Builtin::BI__builtin_clzs:
250f4e853340590d5c32e58379e8c379ea1777d3101Eli Friedman  case Builtin::BI__builtin_clz:
251f4e853340590d5c32e58379e8c379ea1777d3101Eli Friedman  case Builtin::BI__builtin_clzl:
252f4e853340590d5c32e58379e8c379ea1777d3101Eli Friedman  case Builtin::BI__builtin_clzll: {
253f4e853340590d5c32e58379e8c379ea1777d3101Eli Friedman    Value *ArgValue = EmitScalarExpr(E->getArg(0));
2541eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2559cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *ArgType = ArgValue->getType();
2568dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::ctlz, ArgType);
257f4e853340590d5c32e58379e8c379ea1777d3101Eli Friedman
2582acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *ResultType = ConvertType(E->getType());
2598b30a9379f730875ba8fb2d0fe2d43611e0c20ffBob Wilson    Value *ZeroUndef = Builder.getInt1(Target.isCLZForZeroUndef());
2608b30a9379f730875ba8fb2d0fe2d43611e0c20ffBob Wilson    Value *Result = Builder.CreateCall2(F, ArgValue, ZeroUndef);
261f4e853340590d5c32e58379e8c379ea1777d3101Eli Friedman    if (Result->getType() != ResultType)
262eac73e5b3eb3862945bcaa2770c71a727a3ee542Duncan Sands      Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
263eac73e5b3eb3862945bcaa2770c71a727a3ee542Duncan Sands                                     "cast");
264f4e853340590d5c32e58379e8c379ea1777d3101Eli Friedman    return RValue::get(Result);
265f4e853340590d5c32e58379e8c379ea1777d3101Eli Friedman  }
26604b290030eee33295600728450f348989d1a627eDaniel Dunbar  case Builtin::BI__builtin_ffs:
26704b290030eee33295600728450f348989d1a627eDaniel Dunbar  case Builtin::BI__builtin_ffsl:
26804b290030eee33295600728450f348989d1a627eDaniel Dunbar  case Builtin::BI__builtin_ffsll: {
26904b290030eee33295600728450f348989d1a627eDaniel Dunbar    // ffs(x) -> x ? cttz(x) + 1 : 0
27004b290030eee33295600728450f348989d1a627eDaniel Dunbar    Value *ArgValue = EmitScalarExpr(E->getArg(0));
2711eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2729cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *ArgType = ArgValue->getType();
2738dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::cttz, ArgType);
2741eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2752acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *ResultType = ConvertType(E->getType());
27650058ec63f38eabeb94391a61d2e7fb18a062173Chandler Carruth    Value *Tmp = Builder.CreateAdd(Builder.CreateCall2(F, ArgValue,
27750058ec63f38eabeb94391a61d2e7fb18a062173Chandler Carruth                                                       Builder.getTrue()),
278578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer                                   llvm::ConstantInt::get(ArgType, 1));
279c9c88b4159791c48e486ca94e3743b5979e2b7a6Owen Anderson    Value *Zero = llvm::Constant::getNullValue(ArgType);
28004b290030eee33295600728450f348989d1a627eDaniel Dunbar    Value *IsZero = Builder.CreateICmpEQ(ArgValue, Zero, "iszero");
28104b290030eee33295600728450f348989d1a627eDaniel Dunbar    Value *Result = Builder.CreateSelect(IsZero, Zero, Tmp, "ffs");
28204b290030eee33295600728450f348989d1a627eDaniel Dunbar    if (Result->getType() != ResultType)
283eac73e5b3eb3862945bcaa2770c71a727a3ee542Duncan Sands      Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
284eac73e5b3eb3862945bcaa2770c71a727a3ee542Duncan Sands                                     "cast");
28504b290030eee33295600728450f348989d1a627eDaniel Dunbar    return RValue::get(Result);
28604b290030eee33295600728450f348989d1a627eDaniel Dunbar  }
28704b290030eee33295600728450f348989d1a627eDaniel Dunbar  case Builtin::BI__builtin_parity:
28804b290030eee33295600728450f348989d1a627eDaniel Dunbar  case Builtin::BI__builtin_parityl:
28904b290030eee33295600728450f348989d1a627eDaniel Dunbar  case Builtin::BI__builtin_parityll: {
29004b290030eee33295600728450f348989d1a627eDaniel Dunbar    // parity(x) -> ctpop(x) & 1
29104b290030eee33295600728450f348989d1a627eDaniel Dunbar    Value *ArgValue = EmitScalarExpr(E->getArg(0));
2921eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2939cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *ArgType = ArgValue->getType();
2948dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::ctpop, ArgType);
2951eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2962acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *ResultType = ConvertType(E->getType());
297578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    Value *Tmp = Builder.CreateCall(F, ArgValue);
298578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    Value *Result = Builder.CreateAnd(Tmp, llvm::ConstantInt::get(ArgType, 1));
29904b290030eee33295600728450f348989d1a627eDaniel Dunbar    if (Result->getType() != ResultType)
300eac73e5b3eb3862945bcaa2770c71a727a3ee542Duncan Sands      Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
301eac73e5b3eb3862945bcaa2770c71a727a3ee542Duncan Sands                                     "cast");
30204b290030eee33295600728450f348989d1a627eDaniel Dunbar    return RValue::get(Result);
30304b290030eee33295600728450f348989d1a627eDaniel Dunbar  }
30404b290030eee33295600728450f348989d1a627eDaniel Dunbar  case Builtin::BI__builtin_popcount:
30504b290030eee33295600728450f348989d1a627eDaniel Dunbar  case Builtin::BI__builtin_popcountl:
30604b290030eee33295600728450f348989d1a627eDaniel Dunbar  case Builtin::BI__builtin_popcountll: {
30704b290030eee33295600728450f348989d1a627eDaniel Dunbar    Value *ArgValue = EmitScalarExpr(E->getArg(0));
3081eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
3099cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *ArgType = ArgValue->getType();
3108dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::ctpop, ArgType);
3111eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
3122acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *ResultType = ConvertType(E->getType());
313578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    Value *Result = Builder.CreateCall(F, ArgValue);
31404b290030eee33295600728450f348989d1a627eDaniel Dunbar    if (Result->getType() != ResultType)
315eac73e5b3eb3862945bcaa2770c71a727a3ee542Duncan Sands      Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
316eac73e5b3eb3862945bcaa2770c71a727a3ee542Duncan Sands                                     "cast");
31704b290030eee33295600728450f348989d1a627eDaniel Dunbar    return RValue::get(Result);
31804b290030eee33295600728450f348989d1a627eDaniel Dunbar  }
319e42b8a596886fc98e367c73e54d761446700029eFariborz Jahanian  case Builtin::BI__builtin_expect: {
320dd697bc8629f0fa6777245610d52ca7ceb3b67f4Fariborz Jahanian    Value *ArgValue = EmitScalarExpr(E->getArg(0));
3219cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *ArgType = ArgValue->getType();
322558229f267d2cdee69639df04382082e7c7ad54cJakub Staszak
3238dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *FnExpect = CGM.getIntrinsic(Intrinsic::expect, ArgType);
324558229f267d2cdee69639df04382082e7c7ad54cJakub Staszak    Value *ExpectedValue = EmitScalarExpr(E->getArg(1));
325558229f267d2cdee69639df04382082e7c7ad54cJakub Staszak
326558229f267d2cdee69639df04382082e7c7ad54cJakub Staszak    Value *Result = Builder.CreateCall2(FnExpect, ArgValue, ExpectedValue,
327558229f267d2cdee69639df04382082e7c7ad54cJakub Staszak                                        "expval");
328558229f267d2cdee69639df04382082e7c7ad54cJakub Staszak    return RValue::get(Result);
329e42b8a596886fc98e367c73e54d761446700029eFariborz Jahanian  }
330df4852ac816e6050d53b808b86d7c1c9738eb99eAnders Carlsson  case Builtin::BI__builtin_bswap32:
331df4852ac816e6050d53b808b86d7c1c9738eb99eAnders Carlsson  case Builtin::BI__builtin_bswap64: {
3321feedd84221e8dbcc3faf3de27cc42b559db845dChris Lattner    Value *ArgValue = EmitScalarExpr(E->getArg(0));
3339cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *ArgType = ArgValue->getType();
3348dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::bswap, ArgType);
335578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    return RValue::get(Builder.CreateCall(F, ArgValue));
3361eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump  }
337d5f8a4fd4d6dfb0415b93bb7ab721bba5cab1332Daniel Dunbar  case Builtin::BI__builtin_object_size: {
338b16d32f74ffc467a5604934a1f844906be20cf7dMike Stump    // We pass this builtin onto the optimizer so that it can
339b16d32f74ffc467a5604934a1f844906be20cf7dMike Stump    // figure out the object size in more complex cases.
3408dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    llvm::Type *ResType = ConvertType(E->getType());
341fee667f35e64751baa7fefe70b4e7bab06c8cd86Eric Christopher
342fee667f35e64751baa7fefe70b4e7bab06c8cd86Eric Christopher    // LLVM only supports 0 and 2, make sure that we pass along that
343fee667f35e64751baa7fefe70b4e7bab06c8cd86Eric Christopher    // as a boolean.
344fee667f35e64751baa7fefe70b4e7bab06c8cd86Eric Christopher    Value *Ty = EmitScalarExpr(E->getArg(1));
345fee667f35e64751baa7fefe70b4e7bab06c8cd86Eric Christopher    ConstantInt *CI = dyn_cast<ConstantInt>(Ty);
346fee667f35e64751baa7fefe70b4e7bab06c8cd86Eric Christopher    assert(CI);
347fee667f35e64751baa7fefe70b4e7bab06c8cd86Eric Christopher    uint64_t val = CI->getZExtValue();
348d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    CI = ConstantInt::get(Builder.getInt1Ty(), (val & 0x2) >> 1);
349fee667f35e64751baa7fefe70b4e7bab06c8cd86Eric Christopher
3508dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::objectsize, ResType);
351c4c9045dabfc0f0d37dea1b3eb2992654d5b2db1Mike Stump    return RValue::get(Builder.CreateCall2(F,
352c4c9045dabfc0f0d37dea1b3eb2992654d5b2db1Mike Stump                                           EmitScalarExpr(E->getArg(0)),
353fee667f35e64751baa7fefe70b4e7bab06c8cd86Eric Christopher                                           CI));
354d5f8a4fd4d6dfb0415b93bb7ab721bba5cab1332Daniel Dunbar  }
3554493f79fce48cd9cbd9f55fa9d452cde736747a0Daniel Dunbar  case Builtin::BI__builtin_prefetch: {
3564493f79fce48cd9cbd9f55fa9d452cde736747a0Daniel Dunbar    Value *Locality, *RW, *Address = EmitScalarExpr(E->getArg(0));
3574493f79fce48cd9cbd9f55fa9d452cde736747a0Daniel Dunbar    // FIXME: Technically these constants should of type 'int', yes?
3581eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    RW = (E->getNumArgs() > 1) ? EmitScalarExpr(E->getArg(1)) :
35977b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner      llvm::ConstantInt::get(Int32Ty, 0);
3601eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    Locality = (E->getNumArgs() > 2) ? EmitScalarExpr(E->getArg(2)) :
36177b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner      llvm::ConstantInt::get(Int32Ty, 3);
3622eccb672799d19fb535ce349566fea6729cbb891Bruno Cardoso Lopes    Value *Data = llvm::ConstantInt::get(Int32Ty, 1);
3638dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::prefetch);
3642eccb672799d19fb535ce349566fea6729cbb891Bruno Cardoso Lopes    return RValue::get(Builder.CreateCall4(F, Address, RW, Locality, Data));
3654493f79fce48cd9cbd9f55fa9d452cde736747a0Daniel Dunbar  }
3664493f79fce48cd9cbd9f55fa9d452cde736747a0Daniel Dunbar  case Builtin::BI__builtin_trap: {
3678dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::trap);
3684493f79fce48cd9cbd9f55fa9d452cde736747a0Daniel Dunbar    return RValue::get(Builder.CreateCall(F));
369df4852ac816e6050d53b808b86d7c1c9738eb99eAnders Carlsson  }
37021190d54634d6e244e85d28ad915ce2fe86ecbffChris Lattner  case Builtin::BI__builtin_unreachable: {
371cd5b22e12b6513163dd131589746c194090f14e6John McCall    if (CatchUndefined)
372fba565d044a8979cfd916ce52655a6847bfaa601Mike Stump      EmitBranch(getTrapBB());
373cd5b22e12b6513163dd131589746c194090f14e6John McCall    else
374cd5b22e12b6513163dd131589746c194090f14e6John McCall      Builder.CreateUnreachable();
375cd5b22e12b6513163dd131589746c194090f14e6John McCall
376cd5b22e12b6513163dd131589746c194090f14e6John McCall    // We do need to preserve an insertion point.
377d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    EmitBlock(createBasicBlock("unreachable.cont"));
378cd5b22e12b6513163dd131589746c194090f14e6John McCall
379cd5b22e12b6513163dd131589746c194090f14e6John McCall    return RValue::get(0);
38021190d54634d6e244e85d28ad915ce2fe86ecbffChris Lattner  }
38121190d54634d6e244e85d28ad915ce2fe86ecbffChris Lattner
382a933c3c052bbd87b01cc6fc7a7745e1c4b1757fbDaniel Dunbar  case Builtin::BI__builtin_powi:
383a933c3c052bbd87b01cc6fc7a7745e1c4b1757fbDaniel Dunbar  case Builtin::BI__builtin_powif:
384a933c3c052bbd87b01cc6fc7a7745e1c4b1757fbDaniel Dunbar  case Builtin::BI__builtin_powil: {
385a933c3c052bbd87b01cc6fc7a7745e1c4b1757fbDaniel Dunbar    Value *Base = EmitScalarExpr(E->getArg(0));
386a933c3c052bbd87b01cc6fc7a7745e1c4b1757fbDaniel Dunbar    Value *Exponent = EmitScalarExpr(E->getArg(1));
3879cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *ArgType = Base->getType();
3888dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::powi, ArgType);
389578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    return RValue::get(Builder.CreateCall2(F, Base, Exponent));
390a933c3c052bbd87b01cc6fc7a7745e1c4b1757fbDaniel Dunbar  }
391a933c3c052bbd87b01cc6fc7a7745e1c4b1757fbDaniel Dunbar
392fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner  case Builtin::BI__builtin_isgreater:
393fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner  case Builtin::BI__builtin_isgreaterequal:
394fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner  case Builtin::BI__builtin_isless:
395fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner  case Builtin::BI__builtin_islessequal:
396fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner  case Builtin::BI__builtin_islessgreater:
397fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner  case Builtin::BI__builtin_isunordered: {
398fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner    // Ordered comparisons: we know the arguments to these are matching scalar
399fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner    // floating point values.
4001eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    Value *LHS = EmitScalarExpr(E->getArg(0));
401fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner    Value *RHS = EmitScalarExpr(E->getArg(1));
4021eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
403fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner    switch (BuiltinID) {
404b219cfc4d75f0a03630b7c4509ef791b7e97b2c8David Blaikie    default: llvm_unreachable("Unknown ordered comparison");
405fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner    case Builtin::BI__builtin_isgreater:
406fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner      LHS = Builder.CreateFCmpOGT(LHS, RHS, "cmp");
407fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner      break;
408fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner    case Builtin::BI__builtin_isgreaterequal:
409fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner      LHS = Builder.CreateFCmpOGE(LHS, RHS, "cmp");
410fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner      break;
411fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner    case Builtin::BI__builtin_isless:
412fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner      LHS = Builder.CreateFCmpOLT(LHS, RHS, "cmp");
413fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner      break;
414fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner    case Builtin::BI__builtin_islessequal:
415fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner      LHS = Builder.CreateFCmpOLE(LHS, RHS, "cmp");
416fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner      break;
417fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner    case Builtin::BI__builtin_islessgreater:
418fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner      LHS = Builder.CreateFCmpONE(LHS, RHS, "cmp");
419fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner      break;
4201eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump    case Builtin::BI__builtin_isunordered:
421fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner      LHS = Builder.CreateFCmpUNO(LHS, RHS, "cmp");
422fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner      break;
423fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner    }
424fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner    // ZExt bool to int type.
425578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    return RValue::get(Builder.CreateZExt(LHS, ConvertType(E->getType())));
426fe23e217774aaec350086fab839210d7d9e1e3f4Chris Lattner  }
427d6139895f43d161a972d134ffda4229d2f548eb6Eli Friedman  case Builtin::BI__builtin_isnan: {
428d6139895f43d161a972d134ffda4229d2f548eb6Eli Friedman    Value *V = EmitScalarExpr(E->getArg(0));
429d6139895f43d161a972d134ffda4229d2f548eb6Eli Friedman    V = Builder.CreateFCmpUNO(V, V, "cmp");
430578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType())));
431d6139895f43d161a972d134ffda4229d2f548eb6Eli Friedman  }
432420b11850d3f4557421f43f519b59d528329c668Chris Lattner
433420b11850d3f4557421f43f519b59d528329c668Chris Lattner  case Builtin::BI__builtin_isinf: {
434420b11850d3f4557421f43f519b59d528329c668Chris Lattner    // isinf(x) --> fabs(x) == infinity
435420b11850d3f4557421f43f519b59d528329c668Chris Lattner    Value *V = EmitScalarExpr(E->getArg(0));
436420b11850d3f4557421f43f519b59d528329c668Chris Lattner    V = EmitFAbs(*this, V, E->getArg(0)->getType());
437420b11850d3f4557421f43f519b59d528329c668Chris Lattner
438420b11850d3f4557421f43f519b59d528329c668Chris Lattner    V = Builder.CreateFCmpOEQ(V, ConstantFP::getInfinity(V->getType()),"isinf");
439578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType())));
440420b11850d3f4557421f43f519b59d528329c668Chris Lattner  }
44158ae5b4b1e2fc02b95d6650af5755a59639aa153Chris Lattner
44258ae5b4b1e2fc02b95d6650af5755a59639aa153Chris Lattner  // TODO: BI__builtin_isinf_sign
44358ae5b4b1e2fc02b95d6650af5755a59639aa153Chris Lattner  //   isinf_sign(x) -> isinf(x) ? (signbit(x) ? -1 : 1) : 0
4446349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer
4456349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer  case Builtin::BI__builtin_isnormal: {
4466349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer    // isnormal(x) --> x == x && fabsf(x) < infinity && fabsf(x) >= float_min
4476349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer    Value *V = EmitScalarExpr(E->getArg(0));
4486349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer    Value *Eq = Builder.CreateFCmpOEQ(V, V, "iseq");
4496349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer
4506349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer    Value *Abs = EmitFAbs(*this, V, E->getArg(0)->getType());
4516349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer    Value *IsLessThanInf =
4526349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer      Builder.CreateFCmpULT(Abs, ConstantFP::getInfinity(V->getType()),"isinf");
4536349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer    APFloat Smallest = APFloat::getSmallestNormalized(
4546349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer                   getContext().getFloatTypeSemantics(E->getArg(0)->getType()));
4556349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer    Value *IsNormal =
4566349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer      Builder.CreateFCmpUGE(Abs, ConstantFP::get(V->getContext(), Smallest),
4576349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer                            "isnormal");
4586349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer    V = Builder.CreateAnd(Eq, IsLessThanInf, "and");
4596349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer    V = Builder.CreateAnd(V, IsNormal, "and");
4606349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer    return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType())));
4616349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer  }
4626349ce94d1b4fa560bf060c5ca5ad5728ce4fad9Benjamin Kramer
463ed074150c9a775c5e2e1c4ececeba18ba880ce7dChris Lattner  case Builtin::BI__builtin_isfinite: {
464ef004ec5adb0e11815cef3435fa5ac7366d783a9Julien Lerouge    // isfinite(x) --> x == x && fabs(x) != infinity;
465ed074150c9a775c5e2e1c4ececeba18ba880ce7dChris Lattner    Value *V = EmitScalarExpr(E->getArg(0));
466ed074150c9a775c5e2e1c4ececeba18ba880ce7dChris Lattner    Value *Eq = Builder.CreateFCmpOEQ(V, V, "iseq");
467ed074150c9a775c5e2e1c4ececeba18ba880ce7dChris Lattner
468ed074150c9a775c5e2e1c4ececeba18ba880ce7dChris Lattner    Value *Abs = EmitFAbs(*this, V, E->getArg(0)->getType());
469ed074150c9a775c5e2e1c4ececeba18ba880ce7dChris Lattner    Value *IsNotInf =
470ed074150c9a775c5e2e1c4ececeba18ba880ce7dChris Lattner      Builder.CreateFCmpUNE(Abs, ConstantFP::getInfinity(V->getType()),"isinf");
471ed074150c9a775c5e2e1c4ececeba18ba880ce7dChris Lattner
472ed074150c9a775c5e2e1c4ececeba18ba880ce7dChris Lattner    V = Builder.CreateAnd(Eq, IsNotInf, "and");
473ed074150c9a775c5e2e1c4ececeba18ba880ce7dChris Lattner    return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType())));
474ed074150c9a775c5e2e1c4ececeba18ba880ce7dChris Lattner  }
4757867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer
4767867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer  case Builtin::BI__builtin_fpclassify: {
4777867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Value *V = EmitScalarExpr(E->getArg(5));
4782acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *Ty = ConvertType(E->getArg(5)->getType());
4797867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer
4807867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    // Create Result
4817867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    BasicBlock *Begin = Builder.GetInsertBlock();
4827867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    BasicBlock *End = createBasicBlock("fpclassify_end", this->CurFn);
4837867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Builder.SetInsertPoint(End);
4847867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    PHINode *Result =
485bbf3bacb3e0c1ebb3e8a4a8b1330404a7e379315Jay Foad      Builder.CreatePHI(ConvertType(E->getArg(0)->getType()), 4,
4867867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer                        "fpclassify_result");
4877867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer
4887867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    // if (V==0) return FP_ZERO
4897867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Builder.SetInsertPoint(Begin);
4907867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Value *IsZero = Builder.CreateFCmpOEQ(V, Constant::getNullValue(Ty),
4917867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer                                          "iszero");
4927867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Value *ZeroLiteral = EmitScalarExpr(E->getArg(4));
4937867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    BasicBlock *NotZero = createBasicBlock("fpclassify_not_zero", this->CurFn);
4947867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Builder.CreateCondBr(IsZero, End, NotZero);
4957867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Result->addIncoming(ZeroLiteral, Begin);
4967867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer
4977867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    // if (V != V) return FP_NAN
4987867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Builder.SetInsertPoint(NotZero);
4997867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Value *IsNan = Builder.CreateFCmpUNO(V, V, "cmp");
5007867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Value *NanLiteral = EmitScalarExpr(E->getArg(0));
5017867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    BasicBlock *NotNan = createBasicBlock("fpclassify_not_nan", this->CurFn);
5027867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Builder.CreateCondBr(IsNan, End, NotNan);
5037867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Result->addIncoming(NanLiteral, NotZero);
5047867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer
5057867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    // if (fabs(V) == infinity) return FP_INFINITY
5067867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Builder.SetInsertPoint(NotNan);
5077867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Value *VAbs = EmitFAbs(*this, V, E->getArg(5)->getType());
5087867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Value *IsInf =
5097867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer      Builder.CreateFCmpOEQ(VAbs, ConstantFP::getInfinity(V->getType()),
5107867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer                            "isinf");
5117867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Value *InfLiteral = EmitScalarExpr(E->getArg(1));
5127867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    BasicBlock *NotInf = createBasicBlock("fpclassify_not_inf", this->CurFn);
5137867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Builder.CreateCondBr(IsInf, End, NotInf);
5147867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Result->addIncoming(InfLiteral, NotNan);
5157867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer
5167867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    // if (fabs(V) >= MIN_NORMAL) return FP_NORMAL else FP_SUBNORMAL
5177867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Builder.SetInsertPoint(NotInf);
5187867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    APFloat Smallest = APFloat::getSmallestNormalized(
5197867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer        getContext().getFloatTypeSemantics(E->getArg(5)->getType()));
5207867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Value *IsNormal =
5217867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer      Builder.CreateFCmpUGE(VAbs, ConstantFP::get(V->getContext(), Smallest),
5227867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer                            "isnormal");
5237867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Value *NormalResult =
5247867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer      Builder.CreateSelect(IsNormal, EmitScalarExpr(E->getArg(2)),
5257867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer                           EmitScalarExpr(E->getArg(3)));
5267867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Builder.CreateBr(End);
5277867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Result->addIncoming(NormalResult, NotInf);
5287867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer
5297867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    // return Result
5307867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    Builder.SetInsertPoint(End);
5317867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer    return RValue::get(Result);
5327867f1a62b8b42cc2a55cc571608a75db2d516e0Benjamin Kramer  }
533ed074150c9a775c5e2e1c4ececeba18ba880ce7dChris Lattner
534b52fe9ce99970955a5f581f5c66fcd89be9a268bEli Friedman  case Builtin::BIalloca:
5359e800e3dd80d77f6c47054738177bf824089f55aChris Lattner  case Builtin::BI__builtin_alloca: {
5369e800e3dd80d77f6c47054738177bf824089f55aChris Lattner    Value *Size = EmitScalarExpr(E->getArg(0));
537578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    return RValue::get(Builder.CreateAlloca(Builder.getInt8Ty(), Size));
5381caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar  }
539e6dddfd907f6ea58daed5e26eeaacd893d98db9bEli Friedman  case Builtin::BIbzero:
5401caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar  case Builtin::BI__builtin_bzero: {
5411caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar    Value *Address = EmitScalarExpr(E->getArg(0));
5423ecd785aff34381f3704d9cb28fe3ef85af759deMon P Wang    Value *SizeVal = EmitScalarExpr(E->getArg(1));
5439f0c7cc36d29cf591c33962931f5862847145f3eBenjamin Kramer    Builder.CreateMemSet(Address, Builder.getInt8(0), SizeVal, 1, false);
5441caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar    return RValue::get(Address);
5459e800e3dd80d77f6c47054738177bf824089f55aChris Lattner  }
546e6ec205d6d0f4aec27bf49ca1e8fbb139acc2f2bEli Friedman  case Builtin::BImemcpy:
547d4b32e46517358f34e8cfbea35010adfcc3786e0Eli Friedman  case Builtin::BI__builtin_memcpy: {
5481caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar    Value *Address = EmitScalarExpr(E->getArg(0));
5493ecd785aff34381f3704d9cb28fe3ef85af759deMon P Wang    Value *SrcAddr = EmitScalarExpr(E->getArg(1));
5503ecd785aff34381f3704d9cb28fe3ef85af759deMon P Wang    Value *SizeVal = EmitScalarExpr(E->getArg(2));
5519f0c7cc36d29cf591c33962931f5862847145f3eBenjamin Kramer    Builder.CreateMemCpy(Address, SrcAddr, SizeVal, 1, false);
5521caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar    return RValue::get(Address);
5531caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar  }
55455bcace250e1ff366e4482714b344b8cbc8be5f3Fariborz Jahanian
555a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner  case Builtin::BI__builtin___memcpy_chk: {
556a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    // fold __builtin_memcpy_chk(x, y, cst1, cst2) to memset iff cst1<=cst2.
557a6b8b2c09610b8bc4330e948ece8b940c2386406Richard Smith    llvm::APSInt Size, DstSize;
558a6b8b2c09610b8bc4330e948ece8b940c2386406Richard Smith    if (!E->getArg(2)->EvaluateAsInt(Size, CGM.getContext()) ||
559a6b8b2c09610b8bc4330e948ece8b940c2386406Richard Smith        !E->getArg(3)->EvaluateAsInt(DstSize, CGM.getContext()))
560a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner      break;
561a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    if (Size.ugt(DstSize))
562a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner      break;
563a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    Value *Dest = EmitScalarExpr(E->getArg(0));
564a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    Value *Src = EmitScalarExpr(E->getArg(1));
565a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    Value *SizeVal = llvm::ConstantInt::get(Builder.getContext(), Size);
566a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    Builder.CreateMemCpy(Dest, Src, SizeVal, 1, false);
56742f681b83378de1541919c7f72e7555e35158867Chris Lattner    return RValue::get(Dest);
568a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner  }
569a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner
5708e2eab27056a78bf1db50ee09929438ed5ea9d93Fariborz Jahanian  case Builtin::BI__builtin_objc_memmove_collectable: {
57155bcace250e1ff366e4482714b344b8cbc8be5f3Fariborz Jahanian    Value *Address = EmitScalarExpr(E->getArg(0));
57255bcace250e1ff366e4482714b344b8cbc8be5f3Fariborz Jahanian    Value *SrcAddr = EmitScalarExpr(E->getArg(1));
57355bcace250e1ff366e4482714b344b8cbc8be5f3Fariborz Jahanian    Value *SizeVal = EmitScalarExpr(E->getArg(2));
57455bcace250e1ff366e4482714b344b8cbc8be5f3Fariborz Jahanian    CGM.getObjCRuntime().EmitGCMemmoveCollectable(*this,
57555bcace250e1ff366e4482714b344b8cbc8be5f3Fariborz Jahanian                                                  Address, SrcAddr, SizeVal);
57655bcace250e1ff366e4482714b344b8cbc8be5f3Fariborz Jahanian    return RValue::get(Address);
57755bcace250e1ff366e4482714b344b8cbc8be5f3Fariborz Jahanian  }
578a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner
579a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner  case Builtin::BI__builtin___memmove_chk: {
580a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    // fold __builtin_memmove_chk(x, y, cst1, cst2) to memset iff cst1<=cst2.
581a6b8b2c09610b8bc4330e948ece8b940c2386406Richard Smith    llvm::APSInt Size, DstSize;
582a6b8b2c09610b8bc4330e948ece8b940c2386406Richard Smith    if (!E->getArg(2)->EvaluateAsInt(Size, CGM.getContext()) ||
583a6b8b2c09610b8bc4330e948ece8b940c2386406Richard Smith        !E->getArg(3)->EvaluateAsInt(DstSize, CGM.getContext()))
584a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner      break;
585a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    if (Size.ugt(DstSize))
586a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner      break;
587a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    Value *Dest = EmitScalarExpr(E->getArg(0));
588a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    Value *Src = EmitScalarExpr(E->getArg(1));
589a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    Value *SizeVal = llvm::ConstantInt::get(Builder.getContext(), Size);
590a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    Builder.CreateMemMove(Dest, Src, SizeVal, 1, false);
59142f681b83378de1541919c7f72e7555e35158867Chris Lattner    return RValue::get(Dest);
592a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner  }
593a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner
594e6ec205d6d0f4aec27bf49ca1e8fbb139acc2f2bEli Friedman  case Builtin::BImemmove:
5951caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar  case Builtin::BI__builtin_memmove: {
5961caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar    Value *Address = EmitScalarExpr(E->getArg(0));
5973ecd785aff34381f3704d9cb28fe3ef85af759deMon P Wang    Value *SrcAddr = EmitScalarExpr(E->getArg(1));
5983ecd785aff34381f3704d9cb28fe3ef85af759deMon P Wang    Value *SizeVal = EmitScalarExpr(E->getArg(2));
5999f0c7cc36d29cf591c33962931f5862847145f3eBenjamin Kramer    Builder.CreateMemMove(Address, SrcAddr, SizeVal, 1, false);
6001caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar    return RValue::get(Address);
6011caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar  }
602e6ec205d6d0f4aec27bf49ca1e8fbb139acc2f2bEli Friedman  case Builtin::BImemset:
6031caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar  case Builtin::BI__builtin_memset: {
6041caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar    Value *Address = EmitScalarExpr(E->getArg(0));
6059f0c7cc36d29cf591c33962931f5862847145f3eBenjamin Kramer    Value *ByteVal = Builder.CreateTrunc(EmitScalarExpr(E->getArg(1)),
6069f0c7cc36d29cf591c33962931f5862847145f3eBenjamin Kramer                                         Builder.getInt8Ty());
6073ecd785aff34381f3704d9cb28fe3ef85af759deMon P Wang    Value *SizeVal = EmitScalarExpr(E->getArg(2));
6089f0c7cc36d29cf591c33962931f5862847145f3eBenjamin Kramer    Builder.CreateMemSet(Address, ByteVal, SizeVal, 1, false);
6091caae959017b355e9bb61250d5a0d04edbf468b0Daniel Dunbar    return RValue::get(Address);
610d4b32e46517358f34e8cfbea35010adfcc3786e0Eli Friedman  }
611a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner  case Builtin::BI__builtin___memset_chk: {
612a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    // fold __builtin_memset_chk(x, y, cst1, cst2) to memset iff cst1<=cst2.
613a6b8b2c09610b8bc4330e948ece8b940c2386406Richard Smith    llvm::APSInt Size, DstSize;
614a6b8b2c09610b8bc4330e948ece8b940c2386406Richard Smith    if (!E->getArg(2)->EvaluateAsInt(Size, CGM.getContext()) ||
615a6b8b2c09610b8bc4330e948ece8b940c2386406Richard Smith        !E->getArg(3)->EvaluateAsInt(DstSize, CGM.getContext()))
616a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner      break;
617a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    if (Size.ugt(DstSize))
618a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner      break;
619a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    Value *Address = EmitScalarExpr(E->getArg(0));
620a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    Value *ByteVal = Builder.CreateTrunc(EmitScalarExpr(E->getArg(1)),
621a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner                                         Builder.getInt8Ty());
622a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    Value *SizeVal = llvm::ConstantInt::get(Builder.getContext(), Size);
623a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner    Builder.CreateMemSet(Address, ByteVal, SizeVal, 1, false);
624a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner
62542f681b83378de1541919c7f72e7555e35158867Chris Lattner    return RValue::get(Address);
626a5e5e0f41e1dcee4603244ccea3d3956c55c23acChris Lattner  }
627fb17a562135dd7597121da9245d0c1bdcda4146fJohn McCall  case Builtin::BI__builtin_dwarf_cfa: {
628fb17a562135dd7597121da9245d0c1bdcda4146fJohn McCall    // The offset in bytes from the first argument to the CFA.
629fb17a562135dd7597121da9245d0c1bdcda4146fJohn McCall    //
630fb17a562135dd7597121da9245d0c1bdcda4146fJohn McCall    // Why on earth is this in the frontend?  Is there any reason at
631fb17a562135dd7597121da9245d0c1bdcda4146fJohn McCall    // all that the backend can't reasonably determine this while
632fb17a562135dd7597121da9245d0c1bdcda4146fJohn McCall    // lowering llvm.eh.dwarf.cfa()?
633fb17a562135dd7597121da9245d0c1bdcda4146fJohn McCall    //
634fb17a562135dd7597121da9245d0c1bdcda4146fJohn McCall    // TODO: If there's a satisfactory reason, add a target hook for
635fb17a562135dd7597121da9245d0c1bdcda4146fJohn McCall    // this instead of hard-coding 0, which is correct for most targets.
636fb17a562135dd7597121da9245d0c1bdcda4146fJohn McCall    int32_t Offset = 0;
637fb17a562135dd7597121da9245d0c1bdcda4146fJohn McCall
6388dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::eh_dwarf_cfa);
63977b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner    return RValue::get(Builder.CreateCall(F,
64077b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner                                      llvm::ConstantInt::get(Int32Ty, Offset)));
641fb17a562135dd7597121da9245d0c1bdcda4146fJohn McCall  }
642256f77e431bc6b920ec94cf0bb4ad339ca21b8c9Eli Friedman  case Builtin::BI__builtin_return_address: {
64383c2a98012a65b51be66fd76c3a1b13ed782c558Anton Korobeynikov    Value *Depth = EmitScalarExpr(E->getArg(0));
644578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    Depth = Builder.CreateIntCast(Depth, Int32Ty, false);
6458dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::returnaddress);
64683c2a98012a65b51be66fd76c3a1b13ed782c558Anton Korobeynikov    return RValue::get(Builder.CreateCall(F, Depth));
647256f77e431bc6b920ec94cf0bb4ad339ca21b8c9Eli Friedman  }
648256f77e431bc6b920ec94cf0bb4ad339ca21b8c9Eli Friedman  case Builtin::BI__builtin_frame_address: {
64983c2a98012a65b51be66fd76c3a1b13ed782c558Anton Korobeynikov    Value *Depth = EmitScalarExpr(E->getArg(0));
650578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    Depth = Builder.CreateIntCast(Depth, Int32Ty, false);
6518dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::frameaddress);
65283c2a98012a65b51be66fd76c3a1b13ed782c558Anton Korobeynikov    return RValue::get(Builder.CreateCall(F, Depth));
653256f77e431bc6b920ec94cf0bb4ad339ca21b8c9Eli Friedman  }
6543b660efb9f9fa3e87096f4a96a2093cd17c43c2eEli Friedman  case Builtin::BI__builtin_extract_return_addr: {
655492c4f998d848673d3d6c9e6416115df4036a71dJohn McCall    Value *Address = EmitScalarExpr(E->getArg(0));
656492c4f998d848673d3d6c9e6416115df4036a71dJohn McCall    Value *Result = getTargetHooks().decodeReturnAddress(*this, Address);
657492c4f998d848673d3d6c9e6416115df4036a71dJohn McCall    return RValue::get(Result);
658492c4f998d848673d3d6c9e6416115df4036a71dJohn McCall  }
659492c4f998d848673d3d6c9e6416115df4036a71dJohn McCall  case Builtin::BI__builtin_frob_return_addr: {
660492c4f998d848673d3d6c9e6416115df4036a71dJohn McCall    Value *Address = EmitScalarExpr(E->getArg(0));
661492c4f998d848673d3d6c9e6416115df4036a71dJohn McCall    Value *Result = getTargetHooks().encodeReturnAddress(*this, Address);
662492c4f998d848673d3d6c9e6416115df4036a71dJohn McCall    return RValue::get(Result);
6633b660efb9f9fa3e87096f4a96a2093cd17c43c2eEli Friedman  }
6646374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall  case Builtin::BI__builtin_dwarf_sp_column: {
6652acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::IntegerType *Ty
6666374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall      = cast<llvm::IntegerType>(ConvertType(E->getType()));
6676374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall    int Column = getTargetHooks().getDwarfEHStackPointer(CGM);
6686374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall    if (Column == -1) {
6696374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall      CGM.ErrorUnsupported(E, "__builtin_dwarf_sp_column");
6706374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall      return RValue::get(llvm::UndefValue::get(Ty));
6716374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall    }
6726374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall    return RValue::get(llvm::ConstantInt::get(Ty, Column, true));
6736374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall  }
6746374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall  case Builtin::BI__builtin_init_dwarf_reg_size_table: {
6756374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall    Value *Address = EmitScalarExpr(E->getArg(0));
6766374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall    if (getTargetHooks().initDwarfEHRegSizeTable(*this, Address))
6776374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall      CGM.ErrorUnsupported(E, "__builtin_init_dwarf_reg_size_table");
6786374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall    return RValue::get(llvm::UndefValue::get(ConvertType(E->getType())));
6796374c3307e2d73348f7b8cc73eeeb0998ad0ac94John McCall  }
6807ada111fd5e81aff355e67bad0e4083f552b34bdJohn McCall  case Builtin::BI__builtin_eh_return: {
6817ada111fd5e81aff355e67bad0e4083f552b34bdJohn McCall    Value *Int = EmitScalarExpr(E->getArg(0));
6827ada111fd5e81aff355e67bad0e4083f552b34bdJohn McCall    Value *Ptr = EmitScalarExpr(E->getArg(1));
6837ada111fd5e81aff355e67bad0e4083f552b34bdJohn McCall
6842acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::IntegerType *IntTy = cast<llvm::IntegerType>(Int->getType());
6857ada111fd5e81aff355e67bad0e4083f552b34bdJohn McCall    assert((IntTy->getBitWidth() == 32 || IntTy->getBitWidth() == 64) &&
6867ada111fd5e81aff355e67bad0e4083f552b34bdJohn McCall           "LLVM's __builtin_eh_return only supports 32- and 64-bit variants");
6877ada111fd5e81aff355e67bad0e4083f552b34bdJohn McCall    Value *F = CGM.getIntrinsic(IntTy->getBitWidth() == 32
6887ada111fd5e81aff355e67bad0e4083f552b34bdJohn McCall                                  ? Intrinsic::eh_return_i32
6898dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer                                  : Intrinsic::eh_return_i64);
6907ada111fd5e81aff355e67bad0e4083f552b34bdJohn McCall    Builder.CreateCall2(F, Int, Ptr);
691cd5b22e12b6513163dd131589746c194090f14e6John McCall    Builder.CreateUnreachable();
692cd5b22e12b6513163dd131589746c194090f14e6John McCall
693cd5b22e12b6513163dd131589746c194090f14e6John McCall    // We do need to preserve an insertion point.
694d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    EmitBlock(createBasicBlock("builtin_eh_return.cont"));
695cd5b22e12b6513163dd131589746c194090f14e6John McCall
696cd5b22e12b6513163dd131589746c194090f14e6John McCall    return RValue::get(0);
6977ada111fd5e81aff355e67bad0e4083f552b34bdJohn McCall  }
698a6d75c0324ac690107bbaa7193b526ef21466212Eli Friedman  case Builtin::BI__builtin_unwind_init: {
6998dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::eh_unwind_init);
700a6d75c0324ac690107bbaa7193b526ef21466212Eli Friedman    return RValue::get(Builder.CreateCall(F));
701a6d75c0324ac690107bbaa7193b526ef21466212Eli Friedman  }
7025e11085830d4d4c53ff75575ab75889ee5126854John McCall  case Builtin::BI__builtin_extend_pointer: {
7035e11085830d4d4c53ff75575ab75889ee5126854John McCall    // Extends a pointer to the size of an _Unwind_Word, which is
704d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall    // uint64_t on all platforms.  Generally this gets poked into a
705d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall    // register and eventually used as an address, so if the
706d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall    // addressing registers are wider than pointers and the platform
707d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall    // doesn't implicitly ignore high-order bits when doing
708d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall    // addressing, we need to make sure we zext / sext based on
709d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall    // the platform's expectations.
7105e11085830d4d4c53ff75575ab75889ee5126854John McCall    //
7115e11085830d4d4c53ff75575ab75889ee5126854John McCall    // See: http://gcc.gnu.org/ml/gcc-bugs/2002-02/msg00237.html
712d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall
713d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall    // Cast the pointer to intptr_t.
7145e11085830d4d4c53ff75575ab75889ee5126854John McCall    Value *Ptr = EmitScalarExpr(E->getArg(0));
715d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall    Value *Result = Builder.CreatePtrToInt(Ptr, IntPtrTy, "extend.cast");
716d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall
717d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall    // If that's 64 bits, we're done.
718d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall    if (IntPtrTy->getBitWidth() == 64)
719d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall      return RValue::get(Result);
720d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall
721d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall    // Otherwise, ask the codegen data what to do.
722492c4f998d848673d3d6c9e6416115df4036a71dJohn McCall    if (getTargetHooks().extendPointerWithSExt())
723d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall      return RValue::get(Builder.CreateSExt(Result, Int64Ty, "extend.sext"));
724d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall    else
725d0b76ca10feefcfda5cb16698e50197e87a7d876John McCall      return RValue::get(Builder.CreateZExt(Result, Int64Ty, "extend.zext"));
7265e11085830d4d4c53ff75575ab75889ee5126854John McCall  }
727a6d75c0324ac690107bbaa7193b526ef21466212Eli Friedman  case Builtin::BI__builtin_setjmp: {
72878673d9f910e8dfe13248c2426c51d8f9fb28572John McCall    // Buffer is a void**.
729a6d75c0324ac690107bbaa7193b526ef21466212Eli Friedman    Value *Buf = EmitScalarExpr(E->getArg(0));
73078673d9f910e8dfe13248c2426c51d8f9fb28572John McCall
73178673d9f910e8dfe13248c2426c51d8f9fb28572John McCall    // Store the frame pointer to the setjmp buffer.
732a6d75c0324ac690107bbaa7193b526ef21466212Eli Friedman    Value *FrameAddr =
73378673d9f910e8dfe13248c2426c51d8f9fb28572John McCall      Builder.CreateCall(CGM.getIntrinsic(Intrinsic::frameaddress),
73477b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner                         ConstantInt::get(Int32Ty, 0));
735a6d75c0324ac690107bbaa7193b526ef21466212Eli Friedman    Builder.CreateStore(FrameAddr, Buf);
73678673d9f910e8dfe13248c2426c51d8f9fb28572John McCall
7376d172e2985346e55095c75f456901ea5d40fddaaJim Grosbach    // Store the stack pointer to the setjmp buffer.
7386d172e2985346e55095c75f456901ea5d40fddaaJim Grosbach    Value *StackAddr =
7396d172e2985346e55095c75f456901ea5d40fddaaJim Grosbach      Builder.CreateCall(CGM.getIntrinsic(Intrinsic::stacksave));
7406d172e2985346e55095c75f456901ea5d40fddaaJim Grosbach    Value *StackSaveSlot =
74177b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner      Builder.CreateGEP(Buf, ConstantInt::get(Int32Ty, 2));
7426d172e2985346e55095c75f456901ea5d40fddaaJim Grosbach    Builder.CreateStore(StackAddr, StackSaveSlot);
7436d172e2985346e55095c75f456901ea5d40fddaaJim Grosbach
74478673d9f910e8dfe13248c2426c51d8f9fb28572John McCall    // Call LLVM's EH setjmp, which is lightweight.
74578673d9f910e8dfe13248c2426c51d8f9fb28572John McCall    Value *F = CGM.getIntrinsic(Intrinsic::eh_sjlj_setjmp);
746d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    Buf = Builder.CreateBitCast(Buf, Int8PtrTy);
747a6d75c0324ac690107bbaa7193b526ef21466212Eli Friedman    return RValue::get(Builder.CreateCall(F, Buf));
748a6d75c0324ac690107bbaa7193b526ef21466212Eli Friedman  }
749a6d75c0324ac690107bbaa7193b526ef21466212Eli Friedman  case Builtin::BI__builtin_longjmp: {
750a6d75c0324ac690107bbaa7193b526ef21466212Eli Friedman    Value *Buf = EmitScalarExpr(E->getArg(0));
751d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    Buf = Builder.CreateBitCast(Buf, Int8PtrTy);
75278673d9f910e8dfe13248c2426c51d8f9fb28572John McCall
75378673d9f910e8dfe13248c2426c51d8f9fb28572John McCall    // Call LLVM's EH longjmp, which is lightweight.
75478673d9f910e8dfe13248c2426c51d8f9fb28572John McCall    Builder.CreateCall(CGM.getIntrinsic(Intrinsic::eh_sjlj_longjmp), Buf);
75578673d9f910e8dfe13248c2426c51d8f9fb28572John McCall
756cd5b22e12b6513163dd131589746c194090f14e6John McCall    // longjmp doesn't return; mark this as unreachable.
757cd5b22e12b6513163dd131589746c194090f14e6John McCall    Builder.CreateUnreachable();
758cd5b22e12b6513163dd131589746c194090f14e6John McCall
759cd5b22e12b6513163dd131589746c194090f14e6John McCall    // We do need to preserve an insertion point.
760d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    EmitBlock(createBasicBlock("longjmp.cont"));
761cd5b22e12b6513163dd131589746c194090f14e6John McCall
762cd5b22e12b6513163dd131589746c194090f14e6John McCall    return RValue::get(0);
763a6d75c0324ac690107bbaa7193b526ef21466212Eli Friedman  }
7641ffe281890f3cd7728316b45a1f3dd4d3120af7bMon P Wang  case Builtin::BI__sync_fetch_and_add:
7651ffe281890f3cd7728316b45a1f3dd4d3120af7bMon P Wang  case Builtin::BI__sync_fetch_and_sub:
7665caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_or:
7675caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_and:
7685caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_xor:
7695caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_add_and_fetch:
7705caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_sub_and_fetch:
7715caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_and_and_fetch:
7725caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_or_and_fetch:
7735caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_xor_and_fetch:
7745caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_val_compare_and_swap:
7755caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_bool_compare_and_swap:
7765caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_lock_test_and_set:
7775caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_lock_release:
77823aa9c8ca0bc441aab2a38a4c9fc7a1c9e9ac16aChris Lattner  case Builtin::BI__sync_swap:
779b219cfc4d75f0a03630b7c4509ef791b7e97b2c8David Blaikie    llvm_unreachable("Shouldn't make it through sema");
7805caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_add_1:
7815caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_add_2:
7825caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_add_4:
7835caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_add_8:
7845caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_add_16:
785c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::Add, E);
7865caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_sub_1:
7875caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_sub_2:
7885caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_sub_4:
7895caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_sub_8:
7905caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_sub_16:
791c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::Sub, E);
7925caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_or_1:
7935caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_or_2:
7945caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_or_4:
7955caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_or_8:
7965caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_or_16:
797c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::Or, E);
7985caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_and_1:
7995caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_and_2:
8005caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_and_4:
8015caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_and_8:
8025caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_and_16:
803c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::And, E);
8045caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_xor_1:
8055caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_xor_2:
8065caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_xor_4:
8075caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_xor_8:
8085caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_fetch_and_xor_16:
809c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::Xor, E);
8101eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
8115caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  // Clang extensions: not overloaded yet.
8121ffe281890f3cd7728316b45a1f3dd4d3120af7bMon P Wang  case Builtin::BI__sync_fetch_and_min:
813c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::Min, E);
8141ffe281890f3cd7728316b45a1f3dd4d3120af7bMon P Wang  case Builtin::BI__sync_fetch_and_max:
815c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::Max, E);
8161ffe281890f3cd7728316b45a1f3dd4d3120af7bMon P Wang  case Builtin::BI__sync_fetch_and_umin:
817c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::UMin, E);
8181ffe281890f3cd7728316b45a1f3dd4d3120af7bMon P Wang  case Builtin::BI__sync_fetch_and_umax:
819c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::UMax, E);
8200002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar
8215caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_add_and_fetch_1:
8225caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_add_and_fetch_2:
8235caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_add_and_fetch_4:
8245caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_add_and_fetch_8:
8255caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_add_and_fetch_16:
826c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomicPost(*this, llvm::AtomicRMWInst::Add, E,
8270002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar                                llvm::Instruction::Add);
8285caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_sub_and_fetch_1:
8295caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_sub_and_fetch_2:
8305caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_sub_and_fetch_4:
8315caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_sub_and_fetch_8:
8325caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_sub_and_fetch_16:
833c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomicPost(*this, llvm::AtomicRMWInst::Sub, E,
8340002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar                                llvm::Instruction::Sub);
8355caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_and_and_fetch_1:
8365caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_and_and_fetch_2:
8375caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_and_and_fetch_4:
8385caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_and_and_fetch_8:
8395caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_and_and_fetch_16:
840c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomicPost(*this, llvm::AtomicRMWInst::And, E,
8410002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar                                llvm::Instruction::And);
8425caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_or_and_fetch_1:
8435caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_or_and_fetch_2:
8445caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_or_and_fetch_4:
8455caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_or_and_fetch_8:
8465caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_or_and_fetch_16:
847c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomicPost(*this, llvm::AtomicRMWInst::Or, E,
8480002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar                                llvm::Instruction::Or);
8495caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_xor_and_fetch_1:
8505caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_xor_and_fetch_2:
8515caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_xor_and_fetch_4:
8525caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_xor_and_fetch_8:
8535caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_xor_and_fetch_16:
854c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomicPost(*this, llvm::AtomicRMWInst::Xor, E,
8550002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar                                llvm::Instruction::Xor);
8561eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
8575caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_val_compare_and_swap_1:
8585caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_val_compare_and_swap_2:
8595caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_val_compare_and_swap_4:
8605caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_val_compare_and_swap_8:
861cb61a7bbe635cfa941b1aeaaa1fbda1bf900ee51Daniel Dunbar  case Builtin::BI__sync_val_compare_and_swap_16: {
86226815d97c5743481e317f17a8d53a6819d061862John McCall    QualType T = E->getType();
863d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    llvm::Value *DestPtr = EmitScalarExpr(E->getArg(0));
864780a2eb227c3f395a390a143f61bba1724913817Chris Lattner    unsigned AddrSpace =
8654f209445c06a43283c6f72dda7c925538b1578e9Chris Lattner      cast<llvm::PointerType>(DestPtr->getType())->getAddressSpace();
86626815d97c5743481e317f17a8d53a6819d061862John McCall
8679cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::IntegerType *IntType =
868d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall      llvm::IntegerType::get(getLLVMContext(),
869d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall                             getContext().getTypeSize(T));
8709cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
871db4325b098eff5e9e660db19f0148423fb21f27fChandler Carruth
87226815d97c5743481e317f17a8d53a6819d061862John McCall    Value *Args[3];
87326815d97c5743481e317f17a8d53a6819d061862John McCall    Args[0] = Builder.CreateBitCast(DestPtr, IntPtrType);
874d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    Args[1] = EmitScalarExpr(E->getArg(1));
8752acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *ValueType = Args[1]->getType();
876d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    Args[1] = EmitToInt(*this, Args[1], T, IntType);
877d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    Args[2] = EmitToInt(*this, EmitScalarExpr(E->getArg(2)), T, IntType);
87826815d97c5743481e317f17a8d53a6819d061862John McCall
879c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    Value *Result = Builder.CreateAtomicCmpXchg(Args[0], Args[1], Args[2],
880c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman                                                llvm::SequentiallyConsistent);
881d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    Result = EmitFromInt(*this, Result, T, ValueType);
88226815d97c5743481e317f17a8d53a6819d061862John McCall    return RValue::get(Result);
883022012e6e5626c3372e1a5493c0929dfc1fa9e47Anders Carlsson  }
8840002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar
8855caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_bool_compare_and_swap_1:
8865caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_bool_compare_and_swap_2:
8875caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_bool_compare_and_swap_4:
8885caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_bool_compare_and_swap_8:
889cb61a7bbe635cfa941b1aeaaa1fbda1bf900ee51Daniel Dunbar  case Builtin::BI__sync_bool_compare_and_swap_16: {
89026815d97c5743481e317f17a8d53a6819d061862John McCall    QualType T = E->getArg(1)->getType();
891d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    llvm::Value *DestPtr = EmitScalarExpr(E->getArg(0));
892f2b95277be59f7d2a82cef8ea9f4cf6a36074593Chris Lattner    unsigned AddrSpace =
8934f209445c06a43283c6f72dda7c925538b1578e9Chris Lattner      cast<llvm::PointerType>(DestPtr->getType())->getAddressSpace();
89426815d97c5743481e317f17a8d53a6819d061862John McCall
8959cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::IntegerType *IntType =
896d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall      llvm::IntegerType::get(getLLVMContext(),
897d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall                             getContext().getTypeSize(T));
8989cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
899db4325b098eff5e9e660db19f0148423fb21f27fChandler Carruth
90026815d97c5743481e317f17a8d53a6819d061862John McCall    Value *Args[3];
90126815d97c5743481e317f17a8d53a6819d061862John McCall    Args[0] = Builder.CreateBitCast(DestPtr, IntPtrType);
902d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    Args[1] = EmitToInt(*this, EmitScalarExpr(E->getArg(1)), T, IntType);
903d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    Args[2] = EmitToInt(*this, EmitScalarExpr(E->getArg(2)), T, IntType);
90426815d97c5743481e317f17a8d53a6819d061862John McCall
905db4325b098eff5e9e660db19f0148423fb21f27fChandler Carruth    Value *OldVal = Args[1];
906c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    Value *PrevVal = Builder.CreateAtomicCmpXchg(Args[0], Args[1], Args[2],
907c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman                                                 llvm::SequentiallyConsistent);
9080002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar    Value *Result = Builder.CreateICmpEQ(PrevVal, OldVal);
9090002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar    // zext bool to int.
91026815d97c5743481e317f17a8d53a6819d061862John McCall    Result = Builder.CreateZExt(Result, ConvertType(E->getType()));
91126815d97c5743481e317f17a8d53a6819d061862John McCall    return RValue::get(Result);
9120002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar  }
9130002d23aaf10f307273dab5facda01c137283d22Daniel Dunbar
91423aa9c8ca0bc441aab2a38a4c9fc7a1c9e9ac16aChris Lattner  case Builtin::BI__sync_swap_1:
91523aa9c8ca0bc441aab2a38a4c9fc7a1c9e9ac16aChris Lattner  case Builtin::BI__sync_swap_2:
91623aa9c8ca0bc441aab2a38a4c9fc7a1c9e9ac16aChris Lattner  case Builtin::BI__sync_swap_4:
91723aa9c8ca0bc441aab2a38a4c9fc7a1c9e9ac16aChris Lattner  case Builtin::BI__sync_swap_8:
91823aa9c8ca0bc441aab2a38a4c9fc7a1c9e9ac16aChris Lattner  case Builtin::BI__sync_swap_16:
919c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::Xchg, E);
92023aa9c8ca0bc441aab2a38a4c9fc7a1c9e9ac16aChris Lattner
9215caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_lock_test_and_set_1:
9225caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_lock_test_and_set_2:
9235caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_lock_test_and_set_4:
9245caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_lock_test_and_set_8:
9255caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_lock_test_and_set_16:
926c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    return EmitBinaryAtomic(*this, llvm::AtomicRMWInst::Xchg, E);
927cb61a7bbe635cfa941b1aeaaa1fbda1bf900ee51Daniel Dunbar
9285caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_lock_release_1:
9295caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_lock_release_2:
9305caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_lock_release_4:
9315caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534Chris Lattner  case Builtin::BI__sync_lock_release_8:
932f58cd9bca9c2e7373300fc8bb7c57cff7e4eda4fChris Lattner  case Builtin::BI__sync_lock_release_16: {
933f58cd9bca9c2e7373300fc8bb7c57cff7e4eda4fChris Lattner    Value *Ptr = EmitScalarExpr(E->getArg(0));
934eb43f4a8f133c2bc510ae136a556e92b68a6ff44Eli Friedman    llvm::Type *ElLLVMTy =
935f58cd9bca9c2e7373300fc8bb7c57cff7e4eda4fChris Lattner      cast<llvm::PointerType>(Ptr->getType())->getElementType();
936007b56738b00426688ee85baa75174358bd849f9Daniel Dunbar    llvm::StoreInst *Store =
937eb43f4a8f133c2bc510ae136a556e92b68a6ff44Eli Friedman      Builder.CreateStore(llvm::Constant::getNullValue(ElLLVMTy), Ptr);
938eb43f4a8f133c2bc510ae136a556e92b68a6ff44Eli Friedman    QualType ElTy = E->getArg(0)->getType()->getPointeeType();
939eb43f4a8f133c2bc510ae136a556e92b68a6ff44Eli Friedman    CharUnits StoreSize = getContext().getTypeSizeInChars(ElTy);
940eb43f4a8f133c2bc510ae136a556e92b68a6ff44Eli Friedman    Store->setAlignment(StoreSize.getQuantity());
941eb43f4a8f133c2bc510ae136a556e92b68a6ff44Eli Friedman    Store->setAtomic(llvm::Release);
942eb4f81e174b11633f7b85f555ea5d2834d6dae8aDaniel Dunbar    return RValue::get(0);
943f58cd9bca9c2e7373300fc8bb7c57cff7e4eda4fChris Lattner  }
944ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar
945f58cd9bca9c2e7373300fc8bb7c57cff7e4eda4fChris Lattner  case Builtin::BI__sync_synchronize: {
946c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    // We assume this is supposed to correspond to a C++0x-style
947c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    // sequentially-consistent fence (i.e. this is only usable for
948c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    // synchonization, not device I/O or anything like that). This intrinsic
949c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    // is really badly designed in the sense that in theory, there isn't
950c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    // any way to safely use it... but in practice, it mostly works
951c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    // to use it with non-atomic loads and stores to get acquire/release
952c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    // semantics.
953c83b975f1fb9d11e10b5aa25029ae9bb5fa80e07Eli Friedman    Builder.CreateFence(llvm::SequentiallyConsistent);
954eb4f81e174b11633f7b85f555ea5d2834d6dae8aDaniel Dunbar    return RValue::get(0);
955f58cd9bca9c2e7373300fc8bb7c57cff7e4eda4fChris Lattner  }
9561eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
957276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman  case Builtin::BI__atomic_thread_fence:
958276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman  case Builtin::BI__atomic_signal_fence: {
959276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    llvm::SynchronizationScope Scope;
960276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    if (BuiltinID == Builtin::BI__atomic_signal_fence)
961276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      Scope = llvm::SingleThread;
962276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    else
963276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      Scope = llvm::CrossThread;
964276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Value *Order = EmitScalarExpr(E->getArg(0));
965276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    if (isa<llvm::ConstantInt>(Order)) {
966276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      int ord = cast<llvm::ConstantInt>(Order)->getZExtValue();
967276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      switch (ord) {
968276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      case 0:  // memory_order_relaxed
969276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      default: // invalid order
970276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman        break;
971276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      case 1:  // memory_order_consume
972276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      case 2:  // memory_order_acquire
973276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman        Builder.CreateFence(llvm::Acquire, Scope);
974276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman        break;
975276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      case 3:  // memory_order_release
976276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman        Builder.CreateFence(llvm::Release, Scope);
977276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman        break;
978276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      case 4:  // memory_order_acq_rel
979276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman        Builder.CreateFence(llvm::AcquireRelease, Scope);
980276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman        break;
981276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      case 5:  // memory_order_seq_cst
982276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman        Builder.CreateFence(llvm::SequentiallyConsistent, Scope);
983276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman        break;
984276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      }
985276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman      return RValue::get(0);
986276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    }
987276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman
988276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    llvm::BasicBlock *AcquireBB, *ReleaseBB, *AcqRelBB, *SeqCstBB;
989276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    AcquireBB = createBasicBlock("acquire", CurFn);
990276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    ReleaseBB = createBasicBlock("release", CurFn);
991276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    AcqRelBB = createBasicBlock("acqrel", CurFn);
992276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    SeqCstBB = createBasicBlock("seqcst", CurFn);
993276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    llvm::BasicBlock *ContBB = createBasicBlock("atomic.continue", CurFn);
994276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman
995276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Order = Builder.CreateIntCast(Order, Builder.getInt32Ty(), false);
996276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    llvm::SwitchInst *SI = Builder.CreateSwitch(Order, ContBB);
997276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman
998276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.SetInsertPoint(AcquireBB);
999276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.CreateFence(llvm::Acquire, Scope);
1000276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.CreateBr(ContBB);
1001276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    SI->addCase(Builder.getInt32(1), AcquireBB);
1002276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    SI->addCase(Builder.getInt32(2), AcquireBB);
1003276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman
1004276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.SetInsertPoint(ReleaseBB);
1005276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.CreateFence(llvm::Release, Scope);
1006276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.CreateBr(ContBB);
1007276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    SI->addCase(Builder.getInt32(3), ReleaseBB);
1008276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman
1009276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.SetInsertPoint(AcqRelBB);
1010276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.CreateFence(llvm::AcquireRelease, Scope);
1011276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.CreateBr(ContBB);
1012276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    SI->addCase(Builder.getInt32(4), AcqRelBB);
1013276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman
1014276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.SetInsertPoint(SeqCstBB);
1015276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.CreateFence(llvm::SequentiallyConsistent, Scope);
1016276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.CreateBr(ContBB);
1017276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    SI->addCase(Builder.getInt32(5), SeqCstBB);
1018276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman
1019276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    Builder.SetInsertPoint(ContBB);
1020276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman    return RValue::get(0);
1021276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman  }
1022276b061970939293f1abaf694bd3ef05b2cbda79Eli Friedman
1023ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar    // Library functions with special handling.
1024ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar  case Builtin::BIsqrt:
1025ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar  case Builtin::BIsqrtf:
1026ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar  case Builtin::BIsqrtl: {
1027beb41281f8355caa05700d0a77539defbdf428f8John McCall    // TODO: there is currently no set of optimizer flags
1028beb41281f8355caa05700d0a77539defbdf428f8John McCall    // sufficient for us to rewrite sqrt to @llvm.sqrt.
1029beb41281f8355caa05700d0a77539defbdf428f8John McCall    // -fmath-errno=0 is not good enough; we need finiteness.
1030beb41281f8355caa05700d0a77539defbdf428f8John McCall    // We could probably precondition the call with an ult
1031beb41281f8355caa05700d0a77539defbdf428f8John McCall    // against 0, but is that worth the complexity?
1032beb41281f8355caa05700d0a77539defbdf428f8John McCall    break;
1033ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar  }
1034ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar
1035ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar  case Builtin::BIpow:
1036ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar  case Builtin::BIpowf:
1037ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar  case Builtin::BIpowl: {
1038ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar    // Rewrite sqrt to intrinsic if allowed.
103940b598eea1310ec9ed554d56ce3e25b34c585458Argyrios Kyrtzidis    if (!FD->hasAttr<ConstAttr>())
1040ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar      break;
1041ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar    Value *Base = EmitScalarExpr(E->getArg(0));
1042ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar    Value *Exponent = EmitScalarExpr(E->getArg(1));
10439cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *ArgType = Base->getType();
10448dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::pow, ArgType);
1045578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    return RValue::get(Builder.CreateCall2(F, Base, Exponent));
1046ef2abfee3ea16ec74942dc09e9e425f46aeb2582Daniel Dunbar  }
1047ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman
1048094240ab184c3ca4b94e9d7eac80fcd34d8dd30cCameron Zwarich  case Builtin::BIfma:
1049094240ab184c3ca4b94e9d7eac80fcd34d8dd30cCameron Zwarich  case Builtin::BIfmaf:
1050094240ab184c3ca4b94e9d7eac80fcd34d8dd30cCameron Zwarich  case Builtin::BIfmal:
1051094240ab184c3ca4b94e9d7eac80fcd34d8dd30cCameron Zwarich  case Builtin::BI__builtin_fma:
1052094240ab184c3ca4b94e9d7eac80fcd34d8dd30cCameron Zwarich  case Builtin::BI__builtin_fmaf:
1053094240ab184c3ca4b94e9d7eac80fcd34d8dd30cCameron Zwarich  case Builtin::BI__builtin_fmal: {
1054094240ab184c3ca4b94e9d7eac80fcd34d8dd30cCameron Zwarich    // Rewrite fma to intrinsic.
1055094240ab184c3ca4b94e9d7eac80fcd34d8dd30cCameron Zwarich    Value *FirstArg = EmitScalarExpr(E->getArg(0));
10569cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *ArgType = FirstArg->getType();
10578dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Value *F = CGM.getIntrinsic(Intrinsic::fma, ArgType);
1058094240ab184c3ca4b94e9d7eac80fcd34d8dd30cCameron Zwarich    return RValue::get(Builder.CreateCall3(F, FirstArg,
1059094240ab184c3ca4b94e9d7eac80fcd34d8dd30cCameron Zwarich                                              EmitScalarExpr(E->getArg(1)),
1060578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer                                              EmitScalarExpr(E->getArg(2))));
1061094240ab184c3ca4b94e9d7eac80fcd34d8dd30cCameron Zwarich  }
1062094240ab184c3ca4b94e9d7eac80fcd34d8dd30cCameron Zwarich
1063ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman  case Builtin::BI__builtin_signbit:
1064ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman  case Builtin::BI__builtin_signbitf:
1065ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman  case Builtin::BI__builtin_signbitl: {
1066ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman    LLVMContext &C = CGM.getLLVMContext();
1067ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman
1068ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman    Value *Arg = EmitScalarExpr(E->getArg(0));
10692acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *ArgTy = Arg->getType();
1070ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman    if (ArgTy->isPPC_FP128Ty())
1071ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman      break; // FIXME: I'm not sure what the right implementation is here.
1072ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman    int ArgWidth = ArgTy->getPrimitiveSizeInBits();
10732acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *ArgIntTy = llvm::IntegerType::get(C, ArgWidth);
1074ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman    Value *BCArg = Builder.CreateBitCast(Arg, ArgIntTy);
1075ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman    Value *ZeroCmp = llvm::Constant::getNullValue(ArgIntTy);
1076ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman    Value *Result = Builder.CreateICmpSLT(BCArg, ZeroCmp);
1077ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman    return RValue::get(Builder.CreateZExt(Result, ConvertType(E->getType())));
1078ba68b08a05587490ed4c2e3d26f3a742c995c660Eli Friedman  }
107977f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge  case Builtin::BI__builtin_annotation: {
108077f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge    llvm::Value *AnnVal = EmitScalarExpr(E->getArg(0));
108177f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge    llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::annotation,
108277f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge                                      AnnVal->getType());
108377f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge
108477f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge    // Get the annotation string, go through casts. Sema requires this to be a
108577f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge    // non-wide string literal, potentially casted, so the cast<> is safe.
108677f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge    const Expr *AnnotationStrExpr = E->getArg(1)->IgnoreParenCasts();
108777f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge    llvm::StringRef Str = cast<StringLiteral>(AnnotationStrExpr)->getString();
108877f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge    return RValue::get(EmitAnnotationCall(F, AnnVal, Str, E->getExprLoc()));
108977f68bb90af93b95045fb994e7cd68137adcc132Julien Lerouge  }
10907ea2e3f6aae9b7511686d3d26dee690fee81c3aaNate Begeman  }
10911eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1092a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  // If this is an alias for a lib function (e.g. __builtin_sin), emit
1093a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  // the call using the normal call path, but using the unmangled
1094a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  // version of the function name.
1095a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  if (getContext().BuiltinInfo.isLibFunction(BuiltinID))
1096a45680b7e7c49ea9893c6cff585984f3e4120366John McCall    return emitLibraryCall(*this, FD, E,
1097a45680b7e7c49ea9893c6cff585984f3e4120366John McCall                           CGM.getBuiltinLibFunction(FD, BuiltinID));
1098a45680b7e7c49ea9893c6cff585984f3e4120366John McCall
1099a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  // If this is a predefined lib function (e.g. malloc), emit the call
1100a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  // using exactly the normal call path.
1101a45680b7e7c49ea9893c6cff585984f3e4120366John McCall  if (getContext().BuiltinInfo.isPredefinedLibFunction(BuiltinID))
1102a45680b7e7c49ea9893c6cff585984f3e4120366John McCall    return emitLibraryCall(*this, FD, E, EmitScalarExpr(E->getCallee()));
11031eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1104b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner  // See if we have a target specific intrinsic.
1105a6f80ef997f0363386749087b325607eaa5adcfcDale Johannesen  const char *Name = getContext().BuiltinInfo.GetName(BuiltinID);
110655cc2ed722e041228670d26d548e5590e355acedDaniel Dunbar  Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic;
110755cc2ed722e041228670d26d548e5590e355acedDaniel Dunbar  if (const char *Prefix =
11081eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump      llvm::Triple::getArchTypePrefix(Target.getTriple().getArch()))
110955cc2ed722e041228670d26d548e5590e355acedDaniel Dunbar    IntrinsicID = Intrinsic::getIntrinsicForGCCBuiltin(Prefix, Name);
11101eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1111b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner  if (IntrinsicID != Intrinsic::not_intrinsic) {
1112b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner    SmallVector<Value*, 16> Args;
11131eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
111446c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    // Find out if any arguments are required to be integer constant
111546c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    // expressions.
111646c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    unsigned ICEArguments = 0;
111746c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    ASTContext::GetBuiltinTypeError Error;
111846c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    getContext().GetBuiltinType(BuiltinID, Error, &ICEArguments);
111946c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    assert(Error == ASTContext::GE_None && "Should not codegen an error");
112046c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner
1121b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner    Function *F = CGM.getIntrinsic(IntrinsicID);
11222acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::FunctionType *FTy = F->getFunctionType();
11231eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1124b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner    for (unsigned i = 0, e = E->getNumArgs(); i != e; ++i) {
112546c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner      Value *ArgValue;
112646c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner      // If this is a normal argument, just emit it as a scalar.
112746c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner      if ((ICEArguments & (1 << i)) == 0) {
112846c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner        ArgValue = EmitScalarExpr(E->getArg(i));
112946c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner      } else {
113046c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner        // If this is required to be a constant, constant fold it so that we
113146c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner        // know that the generated intrinsic gets a ConstantInt.
113246c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner        llvm::APSInt Result;
113346c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner        bool IsConst = E->getArg(i)->isIntegerConstantExpr(Result,getContext());
113446c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner        assert(IsConst && "Constant arg isn't actually constant?");
113546c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner        (void)IsConst;
1136d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall        ArgValue = llvm::ConstantInt::get(getLLVMContext(), Result);
113746c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner      }
11381eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1139b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner      // If the intrinsic arg type is different from the builtin arg type
1140b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner      // we need to do a bit cast.
11412acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner      llvm::Type *PTy = FTy->getParamType(i);
1142b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner      if (PTy != ArgValue->getType()) {
1143b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner        assert(PTy->canLosslesslyBitCastTo(FTy->getParamType(i)) &&
1144b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner               "Must be able to losslessly bit cast to param");
1145b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner        ArgValue = Builder.CreateBitCast(ArgValue, PTy);
1146b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner      }
11471eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1148b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner      Args.push_back(ArgValue);
1149b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner    }
11501eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
11514c7d9f1507d0f102bd4133bba63348636facd469Jay Foad    Value *V = Builder.CreateCall(F, Args);
1152b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner    QualType BuiltinRetType = E->getType();
11531eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
11548b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner    llvm::Type *RetTy = VoidTy;
11558b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner    if (!BuiltinRetType->isVoidType())
11568b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner      RetTy = ConvertType(BuiltinRetType);
11571eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1158b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner    if (RetTy != V->getType()) {
1159b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner      assert(V->getType()->canLosslesslyBitCastTo(RetTy) &&
1160b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner             "Must be able to losslessly bit cast result type");
1161b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner      V = Builder.CreateBitCast(V, RetTy);
1162b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner    }
11631eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1164b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner    return RValue::get(V);
1165b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner  }
11661eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1167b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner  // See if we have a target specific builtin that needs to be lowered.
1168f02e9ddf5efc75917af712b3c7f909581205f0a5Daniel Dunbar  if (Value *V = EmitTargetBuiltinExpr(BuiltinID, E))
1169b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner    return RValue::get(V);
11701eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1171488e993a135ce700b982bf099c3d6b856301d642Daniel Dunbar  ErrorUnsupported(E, "builtin function");
11721eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1173b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner  // Unknown builtin, for now just dump it out and return undef.
1174b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner  if (hasAggregateLLVMType(E->getType()))
1175195337d2e5d4625ae9dc1328c7cdbc7115b0261bDaniel Dunbar    return RValue::getAggregate(CreateMemTemp(E->getType()));
117603e205031b08669f05c41eed5b896fc94c4a12bbOwen Anderson  return RValue::get(llvm::UndefValue::get(ConvertType(E->getType())));
11771eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump}
1178564f1de67d7ba43646b8740db86d6269e3dfbe0bAnders Carlsson
1179f02e9ddf5efc75917af712b3c7f909581205f0a5Daniel DunbarValue *CodeGenFunction::EmitTargetBuiltinExpr(unsigned BuiltinID,
1180f02e9ddf5efc75917af712b3c7f909581205f0a5Daniel Dunbar                                              const CallExpr *E) {
118155cc2ed722e041228670d26d548e5590e355acedDaniel Dunbar  switch (Target.getTriple().getArch()) {
11822752c0137d95aa2f4ee1cdff4b564bac842e041bChris Lattner  case llvm::Triple::arm:
11832752c0137d95aa2f4ee1cdff4b564bac842e041bChris Lattner  case llvm::Triple::thumb:
11842752c0137d95aa2f4ee1cdff4b564bac842e041bChris Lattner    return EmitARMBuiltinExpr(BuiltinID, E);
118555cc2ed722e041228670d26d548e5590e355acedDaniel Dunbar  case llvm::Triple::x86:
118655cc2ed722e041228670d26d548e5590e355acedDaniel Dunbar  case llvm::Triple::x86_64:
1187f02e9ddf5efc75917af712b3c7f909581205f0a5Daniel Dunbar    return EmitX86BuiltinExpr(BuiltinID, E);
118855cc2ed722e041228670d26d548e5590e355acedDaniel Dunbar  case llvm::Triple::ppc:
118955cc2ed722e041228670d26d548e5590e355acedDaniel Dunbar  case llvm::Triple::ppc64:
1190f02e9ddf5efc75917af712b3c7f909581205f0a5Daniel Dunbar    return EmitPPCBuiltinExpr(BuiltinID, E);
11919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case llvm::Triple::hexagon:
11929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    return EmitHexagonBuiltinExpr(BuiltinID, E);
119355cc2ed722e041228670d26d548e5590e355acedDaniel Dunbar  default:
119455cc2ed722e041228670d26d548e5590e355acedDaniel Dunbar    return 0;
119555cc2ed722e041228670d26d548e5590e355acedDaniel Dunbar  }
1196f02e9ddf5efc75917af712b3c7f909581205f0a5Daniel Dunbar}
1197f02e9ddf5efc75917af712b3c7f909581205f0a5Daniel Dunbar
11988b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattnerstatic llvm::VectorType *GetNeonType(CodeGenFunction *CGF,
11998b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner                                     NeonTypeFlags TypeFlags) {
120083084c863572b48579767a4dd5dc686e1a8d669dNAKAMURA Takumi  int IsQuad = TypeFlags.isQuad();
120183084c863572b48579767a4dd5dc686e1a8d669dNAKAMURA Takumi  switch (TypeFlags.getEltType()) {
1202da95f73b59f9af964e33725c515139d34c90c863Bob Wilson  case NeonTypeFlags::Int8:
1203da95f73b59f9af964e33725c515139d34c90c863Bob Wilson  case NeonTypeFlags::Poly8:
12048b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner    return llvm::VectorType::get(CGF->Int8Ty, 8 << IsQuad);
1205da95f73b59f9af964e33725c515139d34c90c863Bob Wilson  case NeonTypeFlags::Int16:
1206da95f73b59f9af964e33725c515139d34c90c863Bob Wilson  case NeonTypeFlags::Poly16:
1207da95f73b59f9af964e33725c515139d34c90c863Bob Wilson  case NeonTypeFlags::Float16:
12088b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner    return llvm::VectorType::get(CGF->Int16Ty, 4 << IsQuad);
1209da95f73b59f9af964e33725c515139d34c90c863Bob Wilson  case NeonTypeFlags::Int32:
12108b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner    return llvm::VectorType::get(CGF->Int32Ty, 2 << IsQuad);
1211da95f73b59f9af964e33725c515139d34c90c863Bob Wilson  case NeonTypeFlags::Int64:
12128b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner    return llvm::VectorType::get(CGF->Int64Ty, 1 << IsQuad);
1213da95f73b59f9af964e33725c515139d34c90c863Bob Wilson  case NeonTypeFlags::Float32:
12148b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner    return llvm::VectorType::get(CGF->FloatTy, 2 << IsQuad);
1215561d3abc881033776ece385a01a510e1cbc1fa92David Blaikie  }
1216561d3abc881033776ece385a01a510e1cbc1fa92David Blaikie  llvm_unreachable("Invalid NeonTypeFlags element type!");
1217998622c10198a25ba06c93d7e908f88ba0acc920Nate Begeman}
1218998622c10198a25ba06c93d7e908f88ba0acc920Nate Begeman
1219cf55652cf668c1402eee0b12edd2e5a1bc34d7a1Bob WilsonValue *CodeGenFunction::EmitNeonSplat(Value *V, Constant *C) {
1220d075c01c359b9cc120c3accc7166990f9f4ac423Nate Begeman  unsigned nElts = cast<llvm::VectorType>(V->getType())->getNumElements();
12212ce8842641cc312628c4be836d34eb250e7c3f78Chris Lattner  Value* SV = llvm::ConstantVector::getSplat(nElts, C);
1222d075c01c359b9cc120c3accc7166990f9f4ac423Nate Begeman  return Builder.CreateShuffleVector(V, V, SV, "lane");
1223d075c01c359b9cc120c3accc7166990f9f4ac423Nate Begeman}
1224d075c01c359b9cc120c3accc7166990f9f4ac423Nate Begeman
122530d91718a676177f0d0d0210ce4fdb4f616df6e5Nate BegemanValue *CodeGenFunction::EmitNeonCall(Function *F, SmallVectorImpl<Value*> &Ops,
1226db3d4d036037f379f12643e067b229862d61e932Bob Wilson                                     const char *name,
122761eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman                                     unsigned shift, bool rightshift) {
122830d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman  unsigned j = 0;
122930d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman  for (Function::const_arg_iterator ai = F->arg_begin(), ae = F->arg_end();
123030d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman       ai != ae; ++ai, ++j)
123161eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman    if (shift > 0 && shift == j)
123261eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman      Ops[j] = EmitNeonShiftVector(Ops[j], ai->getType(), rightshift);
123361eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman    else
123461eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman      Ops[j] = Builder.CreateBitCast(Ops[j], ai->getType(), name);
123530d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman
12364c7d9f1507d0f102bd4133bba63348636facd469Jay Foad  return Builder.CreateCall(F, Ops, name);
123730d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman}
123830d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman
12392acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris LattnerValue *CodeGenFunction::EmitNeonShiftVector(Value *V, llvm::Type *Ty,
1240464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                                            bool neg) {
12412ce8842641cc312628c4be836d34eb250e7c3f78Chris Lattner  int SV = cast<ConstantInt>(V)->getSExtValue();
1242464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman
12432acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner  llvm::VectorType *VTy = cast<llvm::VectorType>(Ty);
1244464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman  llvm::Constant *C = ConstantInt::get(VTy->getElementType(), neg ? -SV : SV);
12452ce8842641cc312628c4be836d34eb250e7c3f78Chris Lattner  return llvm::ConstantVector::getSplat(VTy->getNumElements(), C);
1246464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman}
1247464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman
124806b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson/// GetPointeeAlignment - Given an expression with a pointer type, find the
124906b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson/// alignment of the type referenced by the pointer.  Skip over implicit
125006b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson/// casts.
125106b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilsonstatic Value *GetPointeeAlignment(CodeGenFunction &CGF, const Expr *Addr) {
125206b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson  unsigned Align = 1;
125306b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson  // Check if the type is a pointer.  The implicit cast operand might not be.
125406b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson  while (Addr->getType()->isPointerType()) {
125506b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    QualType PtTy = Addr->getType()->getPointeeType();
125606b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    unsigned NewA = CGF.getContext().getTypeAlignInChars(PtTy).getQuantity();
125706b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    if (NewA > Align)
125806b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson      Align = NewA;
125906b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson
126006b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    // If the address is an implicit cast, repeat with the cast operand.
126106b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    if (const ImplicitCastExpr *CastAddr = dyn_cast<ImplicitCastExpr>(Addr)) {
126206b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson      Addr = CastAddr->getSubExpr();
126306b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson      continue;
126406b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    }
126506b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    break;
126606b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson  }
126706b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson  return llvm::ConstantInt::get(CGF.Int32Ty, Align);
126806b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson}
126906b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson
12702752c0137d95aa2f4ee1cdff4b564bac842e041bChris LattnerValue *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
12712752c0137d95aa2f4ee1cdff4b564bac842e041bChris Lattner                                           const CallExpr *E) {
1272e140af3e27016f902146023fba7680b43043ec07Rafael Espindola  if (BuiltinID == ARM::BI__clear_cache) {
127379ba509b0106fd0a1ff832baeb1fdb5430527efeRafael Espindola    const FunctionDecl *FD = E->getDirectCallee();
12748a37c79f03e62aecfa2c58b9179f90dd1fcdb253Eric Christopher    // Oddly people write this call without args on occasion and gcc accepts
12758a37c79f03e62aecfa2c58b9179f90dd1fcdb253Eric Christopher    // it - it's also marked as varargs in the description file.
12765f9e272e632e951b1efe824cd16acb4d96077930Chris Lattner    SmallVector<Value*, 2> Ops;
12778a37c79f03e62aecfa2c58b9179f90dd1fcdb253Eric Christopher    for (unsigned i = 0; i < E->getNumArgs(); i++)
12788a37c79f03e62aecfa2c58b9179f90dd1fcdb253Eric Christopher      Ops.push_back(EmitScalarExpr(E->getArg(i)));
12792acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *Ty = CGM.getTypes().ConvertType(FD->getType());
12802acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::FunctionType *FTy = cast<llvm::FunctionType>(Ty);
12815f9e272e632e951b1efe824cd16acb4d96077930Chris Lattner    StringRef Name = FD->getName();
12824c7d9f1507d0f102bd4133bba63348636facd469Jay Foad    return Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name), Ops);
12832752c0137d95aa2f4ee1cdff4b564bac842e041bChris Lattner  }
1284e140af3e27016f902146023fba7680b43043ec07Rafael Espindola
128526c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes  if (BuiltinID == ARM::BI__builtin_arm_ldrexd) {
128626c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Function *F = CGM.getIntrinsic(Intrinsic::arm_ldrexd);
128726c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes
128826c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Value *LdPtr = EmitScalarExpr(E->getArg(0));
128926c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Value *Val = Builder.CreateCall(F, LdPtr, "ldrexd");
129026c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes
129126c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Value *Val0 = Builder.CreateExtractValue(Val, 1);
129226c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Value *Val1 = Builder.CreateExtractValue(Val, 0);
129326c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Val0 = Builder.CreateZExt(Val0, Int64Ty);
129426c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Val1 = Builder.CreateZExt(Val1, Int64Ty);
129526c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes
129626c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Value *ShiftCst = llvm::ConstantInt::get(Int64Ty, 32);
129726c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Val = Builder.CreateShl(Val0, ShiftCst, "shl", true /* nuw */);
129826c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    return Builder.CreateOr(Val, Val1);
129926c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes  }
130026c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes
130126c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes  if (BuiltinID == ARM::BI__builtin_arm_strexd) {
130226c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Function *F = CGM.getIntrinsic(Intrinsic::arm_strexd);
13037650d95a1a616ea300f37126a8dfc93dc19a662aChris Lattner    llvm::Type *STy = llvm::StructType::get(Int32Ty, Int32Ty, NULL);
130426c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes
130526c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Value *One = llvm::ConstantInt::get(Int32Ty, 1);
1306578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    Value *Tmp = Builder.CreateAlloca(Int64Ty, One);
130726c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Value *Val = EmitScalarExpr(E->getArg(0));
130826c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Builder.CreateStore(Val, Tmp);
130926c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes
131026c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Value *LdPtr = Builder.CreateBitCast(Tmp,llvm::PointerType::getUnqual(STy));
131126c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Val = Builder.CreateLoad(LdPtr);
131226c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes
131326c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Value *Arg0 = Builder.CreateExtractValue(Val, 0);
131426c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Value *Arg1 = Builder.CreateExtractValue(Val, 1);
131526c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    Value *StPtr = EmitScalarExpr(E->getArg(1));
131626c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes    return Builder.CreateCall3(F, Arg0, Arg1, StPtr, "strexd");
131726c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes  }
131826c1b8df8d1af0d8ef7f6c726fe1a8a9ddc60267Bruno Cardoso Lopes
13195f9e272e632e951b1efe824cd16acb4d96077930Chris Lattner  SmallVector<Value*, 4> Ops;
1320e140af3e27016f902146023fba7680b43043ec07Rafael Espindola  for (unsigned i = 0, e = E->getNumArgs() - 1; i != e; i++)
1321e140af3e27016f902146023fba7680b43043ec07Rafael Espindola    Ops.push_back(EmitScalarExpr(E->getArg(i)));
1322e140af3e27016f902146023fba7680b43043ec07Rafael Espindola
132383bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  // vget_lane and vset_lane are not overloaded and do not have an extra
132483bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  // argument that specifies the vector type.
132583bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  switch (BuiltinID) {
132683bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  default: break;
132783bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vget_lane_i8:
132883bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vget_lane_i16:
132983bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vget_lane_i32:
133083bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vget_lane_i64:
133183bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vget_lane_f32:
133283bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vgetq_lane_i8:
133383bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vgetq_lane_i16:
133483bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vgetq_lane_i32:
133583bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vgetq_lane_i64:
133683bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vgetq_lane_f32:
133783bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson    return Builder.CreateExtractElement(Ops[0], EmitScalarExpr(E->getArg(1)),
133883bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson                                        "vget_lane");
133983bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vset_lane_i8:
134083bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vset_lane_i16:
134183bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vset_lane_i32:
134283bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vset_lane_i64:
134383bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vset_lane_f32:
134483bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vsetq_lane_i8:
134583bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vsetq_lane_i16:
134683bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vsetq_lane_i32:
134783bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vsetq_lane_i64:
134883bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  case ARM::BI__builtin_neon_vsetq_lane_f32:
134983bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson    Ops.push_back(EmitScalarExpr(E->getArg(2)));
135083bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson    return Builder.CreateInsertElement(Ops[1], Ops[0], Ops[2], "vset_lane");
135183bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  }
135283bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson
135383bbba1fc98dd3b2a351013a40808e995e648f40Bob Wilson  // Get the last argument, which specifies the vector type.
1354e140af3e27016f902146023fba7680b43043ec07Rafael Espindola  llvm::APSInt Result;
1355e140af3e27016f902146023fba7680b43043ec07Rafael Espindola  const Expr *Arg = E->getArg(E->getNumArgs()-1);
1356e140af3e27016f902146023fba7680b43043ec07Rafael Espindola  if (!Arg->isIntegerConstantExpr(Result, getContext()))
1357e140af3e27016f902146023fba7680b43043ec07Rafael Espindola    return 0;
1358e140af3e27016f902146023fba7680b43043ec07Rafael Espindola
135999c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman  if (BuiltinID == ARM::BI__builtin_arm_vcvtr_f ||
136099c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman      BuiltinID == ARM::BI__builtin_arm_vcvtr_d) {
136199c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman    // Determine the overloaded type of this builtin.
13629cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *Ty;
136399c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman    if (BuiltinID == ARM::BI__builtin_arm_vcvtr_f)
13648b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner      Ty = FloatTy;
136599c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman    else
13668b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner      Ty = DoubleTy;
136799c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman
136899c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman    // Determine whether this is an unsigned conversion or not.
136999c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman    bool usgn = Result.getZExtValue() == 1;
137099c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman    unsigned Int = usgn ? Intrinsic::arm_vcvtru : Intrinsic::arm_vcvtr;
137199c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman
137299c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman    // Call the appropriate intrinsic.
13738dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Int, Ty);
13744c7d9f1507d0f102bd4133bba63348636facd469Jay Foad    return Builder.CreateCall(F, Ops, "vcvtr");
137599c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman  }
137699c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman
137799c40bb13b523d58d7aeb6446e4f486d6918ca58Nate Begeman  // Determine the type of this overloaded NEON intrinsic.
1378da95f73b59f9af964e33725c515139d34c90c863Bob Wilson  NeonTypeFlags Type(Result.getZExtValue());
1379da95f73b59f9af964e33725c515139d34c90c863Bob Wilson  bool usgn = Type.isUnsigned();
1380da95f73b59f9af964e33725c515139d34c90c863Bob Wilson  bool quad = Type.isQuad();
13817965396d8d6ac23ec4c4f9d01d216f2e73d7fc72Bob Wilson  bool rightShift = false;
1382e140af3e27016f902146023fba7680b43043ec07Rafael Espindola
13838b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner  llvm::VectorType *VTy = GetNeonType(this, Type);
13849cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner  llvm::Type *Ty = VTy;
1385e140af3e27016f902146023fba7680b43043ec07Rafael Espindola  if (!Ty)
1386e140af3e27016f902146023fba7680b43043ec07Rafael Espindola    return 0;
1387e140af3e27016f902146023fba7680b43043ec07Rafael Espindola
1388e140af3e27016f902146023fba7680b43043ec07Rafael Espindola  unsigned Int;
1389e140af3e27016f902146023fba7680b43043ec07Rafael Espindola  switch (BuiltinID) {
1390e140af3e27016f902146023fba7680b43043ec07Rafael Espindola  default: return 0;
1391537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vabd_v:
1392537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vabdq_v:
1393998622c10198a25ba06c93d7e908f88ba0acc920Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vabdu : Intrinsic::arm_neon_vabds;
13948dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vabd");
1395537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vabs_v:
1396537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vabsq_v:
13978dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vabs, Ty),
1398548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman                        Ops, "vabs");
1399537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vaddhn_v:
14008dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vaddhn, Ty),
1401548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman                        Ops, "vaddhn");
1402537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcale_v:
14039eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman    std::swap(Ops[0], Ops[1]);
1404537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcage_v: {
1405d185035263b98cdde75a869b26b5e5e2e6b13fdfBob Wilson    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vacged);
140630d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman    return EmitNeonCall(F, Ops, "vcage");
140730d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman  }
1408537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcaleq_v:
14099eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman    std::swap(Ops[0], Ops[1]);
1410537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcageq_v: {
1411d185035263b98cdde75a869b26b5e5e2e6b13fdfBob Wilson    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vacgeq);
141230d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman    return EmitNeonCall(F, Ops, "vcage");
141330d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman  }
1414537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcalt_v:
14159eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman    std::swap(Ops[0], Ops[1]);
1416537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcagt_v: {
1417d185035263b98cdde75a869b26b5e5e2e6b13fdfBob Wilson    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vacgtd);
141830d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman    return EmitNeonCall(F, Ops, "vcagt");
141930d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman  }
1420537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcaltq_v:
14219eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman    std::swap(Ops[0], Ops[1]);
1422537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcagtq_v: {
1423d185035263b98cdde75a869b26b5e5e2e6b13fdfBob Wilson    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vacgtq);
142430d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman    return EmitNeonCall(F, Ops, "vcagt");
142530d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman  }
1426537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcls_v:
1427537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vclsq_v: {
14288dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vcls, Ty);
142930d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman    return EmitNeonCall(F, Ops, "vcls");
14309eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman  }
1431537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vclz_v:
1432537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vclzq_v: {
14338dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vclz, Ty);
143430d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman    return EmitNeonCall(F, Ops, "vclz");
14359eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman  }
1436537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcnt_v:
1437537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcntq_v: {
14388dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vcnt, Ty);
143930d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman    return EmitNeonCall(F, Ops, "vcnt");
14409eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman  }
1441537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvt_f16_v: {
1442da95f73b59f9af964e33725c515139d34c90c863Bob Wilson    assert(Type.getEltType() == NeonTypeFlags::Float16 && !quad &&
1443da95f73b59f9af964e33725c515139d34c90c863Bob Wilson           "unexpected vcvt_f16_v builtin");
144446e392ae6d09979b087d7b1aca3b816ba4199b89Bob Wilson    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vcvtfp2hf);
144546e392ae6d09979b087d7b1aca3b816ba4199b89Bob Wilson    return EmitNeonCall(F, Ops, "vcvt");
144646e392ae6d09979b087d7b1aca3b816ba4199b89Bob Wilson  }
1447537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvt_f32_f16: {
1448da95f73b59f9af964e33725c515139d34c90c863Bob Wilson    assert(Type.getEltType() == NeonTypeFlags::Float16 && !quad &&
1449da95f73b59f9af964e33725c515139d34c90c863Bob Wilson           "unexpected vcvt_f32_f16 builtin");
145046e392ae6d09979b087d7b1aca3b816ba4199b89Bob Wilson    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vcvthf2fp);
145146e392ae6d09979b087d7b1aca3b816ba4199b89Bob Wilson    return EmitNeonCall(F, Ops, "vcvt");
145246e392ae6d09979b087d7b1aca3b816ba4199b89Bob Wilson  }
1453537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvt_f32_v:
1454da95f73b59f9af964e33725c515139d34c90c863Bob Wilson  case ARM::BI__builtin_neon_vcvtq_f32_v:
145530d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
14568b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner    Ty = GetNeonType(this, NeonTypeFlags(NeonTypeFlags::Float32, false, quad));
14579eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman    return usgn ? Builder.CreateUIToFP(Ops[0], Ty, "vcvt")
14589eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman                : Builder.CreateSIToFP(Ops[0], Ty, "vcvt");
1459537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvt_s32_v:
1460537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvt_u32_v:
1461537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvtq_s32_v:
1462537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvtq_u32_v: {
1463da95f73b59f9af964e33725c515139d34c90c863Bob Wilson    llvm::Type *FloatTy =
14648b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner      GetNeonType(this, NeonTypeFlags(NeonTypeFlags::Float32, false, quad));
1465da95f73b59f9af964e33725c515139d34c90c863Bob Wilson    Ops[0] = Builder.CreateBitCast(Ops[0], FloatTy);
14669eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman    return usgn ? Builder.CreateFPToUI(Ops[0], Ty, "vcvt")
14679eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman                : Builder.CreateFPToSI(Ops[0], Ty, "vcvt");
14689eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman  }
1469537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvt_n_f32_v:
1470537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvtq_n_f32_v: {
1471da95f73b59f9af964e33725c515139d34c90c863Bob Wilson    llvm::Type *FloatTy =
14728b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner      GetNeonType(this, NeonTypeFlags(NeonTypeFlags::Float32, false, quad));
1473da95f73b59f9af964e33725c515139d34c90c863Bob Wilson    llvm::Type *Tys[2] = { FloatTy, Ty };
1474da95f73b59f9af964e33725c515139d34c90c863Bob Wilson    Int = usgn ? Intrinsic::arm_neon_vcvtfxu2fp
1475da95f73b59f9af964e33725c515139d34c90c863Bob Wilson               : Intrinsic::arm_neon_vcvtfxs2fp;
14768dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Int, Tys);
147730d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman    return EmitNeonCall(F, Ops, "vcvt_n");
14789eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman  }
1479537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvt_n_s32_v:
1480537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvt_n_u32_v:
1481537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvtq_n_s32_v:
1482537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vcvtq_n_u32_v: {
1483da95f73b59f9af964e33725c515139d34c90c863Bob Wilson    llvm::Type *FloatTy =
14848b418685e9e4f02f4eb2a76e1ec063e07552b68dChris Lattner      GetNeonType(this, NeonTypeFlags(NeonTypeFlags::Float32, false, quad));
1485da95f73b59f9af964e33725c515139d34c90c863Bob Wilson    llvm::Type *Tys[2] = { Ty, FloatTy };
1486da95f73b59f9af964e33725c515139d34c90c863Bob Wilson    Int = usgn ? Intrinsic::arm_neon_vcvtfp2fxu
1487da95f73b59f9af964e33725c515139d34c90c863Bob Wilson               : Intrinsic::arm_neon_vcvtfp2fxs;
14888dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Int, Tys);
148930d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman    return EmitNeonCall(F, Ops, "vcvt_n");
149030d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman  }
1491537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vext_v:
1492537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vextq_v: {
1493fb018d153cbf12fd2a4a278cbf7614b9a2e2835eChris Lattner    int CV = cast<ConstantInt>(Ops[2])->getSExtValue();
14941c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    SmallVector<Constant*, 16> Indices;
14954be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i)
149677b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner      Indices.push_back(ConstantInt::get(Int32Ty, i+CV));
149730d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman
149830d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
149930d91718a676177f0d0d0210ce4fdb4f616df6e5Nate Begeman    Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
1500fb018d153cbf12fd2a4a278cbf7614b9a2e2835eChris Lattner    Value *SV = llvm::ConstantVector::get(Indices);
15011c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    return Builder.CreateShuffleVector(Ops[0], Ops[1], SV, "vext");
15021c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman  }
1503537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vhadd_v:
1504537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vhaddq_v:
1505df98e1d1da5ab1ca7c325378fc1c2eaa90a6476dNate Begeman    Int = usgn ? Intrinsic::arm_neon_vhaddu : Intrinsic::arm_neon_vhadds;
15068dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vhadd");
1507537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vhsub_v:
1508537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vhsubq_v:
1509df98e1d1da5ab1ca7c325378fc1c2eaa90a6476dNate Begeman    Int = usgn ? Intrinsic::arm_neon_vhsubu : Intrinsic::arm_neon_vhsubs;
15108dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vhsub");
1511537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld1_v:
1512537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld1q_v:
151306b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
15148dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vld1, Ty),
15154be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman                        Ops, "vld1");
1516537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld1_lane_v:
1517eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson  case ARM::BI__builtin_neon_vld1q_lane_v: {
15184be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
15194be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ty = llvm::PointerType::getUnqual(VTy->getElementType());
15204be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
1521eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson    LoadInst *Ld = Builder.CreateLoad(Ops[0]);
1522eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson    Value *Align = GetPointeeAlignment(*this, E->getArg(0));
1523eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson    Ld->setAlignment(cast<ConstantInt>(Align)->getZExtValue());
1524eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson    return Builder.CreateInsertElement(Ops[1], Ld, Ops[2], "vld1_lane");
1525eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson  }
1526537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld1_dup_v:
1527537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld1q_dup_v: {
15284be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Value *V = UndefValue::get(Ty);
15294be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ty = llvm::PointerType::getUnqual(VTy->getElementType());
15304be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
1531eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson    LoadInst *Ld = Builder.CreateLoad(Ops[0]);
1532eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson    Value *Align = GetPointeeAlignment(*this, E->getArg(0));
1533eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson    Ld->setAlignment(cast<ConstantInt>(Align)->getZExtValue());
153477b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner    llvm::Constant *CI = ConstantInt::get(Int32Ty, 0);
1535eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson    Ops[0] = Builder.CreateInsertElement(V, Ld, CI);
15364be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    return EmitNeonSplat(Ops[0], CI);
15374be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman  }
1538537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld2_v:
1539537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld2q_v: {
15408dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vld2, Ty);
154106b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Value *Align = GetPointeeAlignment(*this, E->getArg(1));
154206b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops[1] = Builder.CreateCall2(F, Ops[1], Align, "vld2");
15434be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
15444be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
15454be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    return Builder.CreateStore(Ops[1], Ops[0]);
15464be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman  }
1547537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld3_v:
1548537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld3q_v: {
15498dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vld3, Ty);
155006b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Value *Align = GetPointeeAlignment(*this, E->getArg(1));
155106b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops[1] = Builder.CreateCall2(F, Ops[1], Align, "vld3");
15524be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
15534be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
15544be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    return Builder.CreateStore(Ops[1], Ops[0]);
15554be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman  }
1556537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld4_v:
1557537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld4q_v: {
15588dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vld4, Ty);
155906b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Value *Align = GetPointeeAlignment(*this, E->getArg(1));
156006b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops[1] = Builder.CreateCall2(F, Ops[1], Align, "vld4");
15614be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
15624be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
15634be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    return Builder.CreateStore(Ops[1], Ops[0]);
15644be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman  }
1565537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld2_lane_v:
1566537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld2q_lane_v: {
15678dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vld2lane, Ty);
15684be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[2] = Builder.CreateBitCast(Ops[2], Ty);
15694be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[3] = Builder.CreateBitCast(Ops[3], Ty);
157006b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops.push_back(GetPointeeAlignment(*this, E->getArg(1)));
15711cbac8ac446cf513dbc7486dd50abd55bcfc62c6Frits van Bommel    Ops[1] = Builder.CreateCall(F, makeArrayRef(Ops).slice(1), "vld2_lane");
15724be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
15734be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
15744be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    return Builder.CreateStore(Ops[1], Ops[0]);
15754be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman  }
1576537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld3_lane_v:
1577537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld3q_lane_v: {
15788dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vld3lane, Ty);
15794be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[2] = Builder.CreateBitCast(Ops[2], Ty);
15804be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[3] = Builder.CreateBitCast(Ops[3], Ty);
15814be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[4] = Builder.CreateBitCast(Ops[4], Ty);
158206b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops.push_back(GetPointeeAlignment(*this, E->getArg(1)));
15831cbac8ac446cf513dbc7486dd50abd55bcfc62c6Frits van Bommel    Ops[1] = Builder.CreateCall(F, makeArrayRef(Ops).slice(1), "vld3_lane");
15844be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
15854be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
15864be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    return Builder.CreateStore(Ops[1], Ops[0]);
15874be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman  }
1588537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld4_lane_v:
1589537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld4q_lane_v: {
15908dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vld4lane, Ty);
15914be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[2] = Builder.CreateBitCast(Ops[2], Ty);
15924be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[3] = Builder.CreateBitCast(Ops[3], Ty);
15934be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[4] = Builder.CreateBitCast(Ops[4], Ty);
15944be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[5] = Builder.CreateBitCast(Ops[5], Ty);
159506b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops.push_back(GetPointeeAlignment(*this, E->getArg(1)));
15961cbac8ac446cf513dbc7486dd50abd55bcfc62c6Frits van Bommel    Ops[1] = Builder.CreateCall(F, makeArrayRef(Ops).slice(1), "vld3_lane");
15974be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
15984be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
15994be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    return Builder.CreateStore(Ops[1], Ops[0]);
16004be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman  }
1601537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld2_dup_v:
1602537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld3_dup_v:
1603537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vld4_dup_v: {
1604a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson    // Handle 64-bit elements as a special-case.  There is no "dup" needed.
1605a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson    if (VTy->getElementType()->getPrimitiveSizeInBits() == 64) {
1606a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson      switch (BuiltinID) {
1607537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson      case ARM::BI__builtin_neon_vld2_dup_v:
1608a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson        Int = Intrinsic::arm_neon_vld2;
1609a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson        break;
1610537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson      case ARM::BI__builtin_neon_vld3_dup_v:
1611a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson        Int = Intrinsic::arm_neon_vld2;
1612a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson        break;
1613537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson      case ARM::BI__builtin_neon_vld4_dup_v:
1614a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson        Int = Intrinsic::arm_neon_vld2;
1615a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson        break;
1616b219cfc4d75f0a03630b7c4509ef791b7e97b2c8David Blaikie      default: llvm_unreachable("unknown vld_dup intrinsic?");
1617a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson      }
16188dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer      Function *F = CGM.getIntrinsic(Int, Ty);
1619a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson      Value *Align = GetPointeeAlignment(*this, E->getArg(1));
1620a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson      Ops[1] = Builder.CreateCall2(F, Ops[1], Align, "vld_dup");
1621a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson      Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
1622a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson      Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
1623a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson      return Builder.CreateStore(Ops[1], Ops[0]);
1624a0eb23b79aba48a8141daa4eb1aba66266b41abeBob Wilson    }
16254be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    switch (BuiltinID) {
1626537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson    case ARM::BI__builtin_neon_vld2_dup_v:
16274be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      Int = Intrinsic::arm_neon_vld2lane;
16284be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      break;
1629537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson    case ARM::BI__builtin_neon_vld3_dup_v:
16304be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      Int = Intrinsic::arm_neon_vld2lane;
16314be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      break;
1632537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson    case ARM::BI__builtin_neon_vld4_dup_v:
16334be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      Int = Intrinsic::arm_neon_vld2lane;
16344be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      break;
1635b219cfc4d75f0a03630b7c4509ef791b7e97b2c8David Blaikie    default: llvm_unreachable("unknown vld_dup intrinsic?");
16364be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    }
16378dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Function *F = CGM.getIntrinsic(Int, Ty);
16382acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::StructType *STy = cast<llvm::StructType>(F->getReturnType());
16394be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman
16404be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    SmallVector<Value*, 6> Args;
16414be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Args.push_back(Ops[1]);
16424be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Args.append(STy->getNumElements(), UndefValue::get(Ty));
16434be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman
164477b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner    llvm::Constant *CI = ConstantInt::get(Int32Ty, 0);
16454be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Args.push_back(CI);
164606b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Args.push_back(GetPointeeAlignment(*this, E->getArg(1)));
16474be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman
16484c7d9f1507d0f102bd4133bba63348636facd469Jay Foad    Ops[1] = Builder.CreateCall(F, Args, "vld_dup");
16494be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    // splat lane 0 to all elts in each vector of the result.
16504be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
16514be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      Value *Val = Builder.CreateExtractValue(Ops[1], i);
16524be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      Value *Elt = Builder.CreateBitCast(Val, Ty);
16534be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      Elt = EmitNeonSplat(Elt, CI);
16544be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      Elt = Builder.CreateBitCast(Elt, Val->getType());
16554be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      Ops[1] = Builder.CreateInsertValue(Ops[1], Elt, i);
16564be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    }
16574be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
16584be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
16594be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    return Builder.CreateStore(Ops[1], Ops[0]);
16604be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman  }
1661537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vmax_v:
1662537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vmaxq_v:
1663df98e1d1da5ab1ca7c325378fc1c2eaa90a6476dNate Begeman    Int = usgn ? Intrinsic::arm_neon_vmaxu : Intrinsic::arm_neon_vmaxs;
16648dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vmax");
1665537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vmin_v:
1666537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vminq_v:
1667df98e1d1da5ab1ca7c325378fc1c2eaa90a6476dNate Begeman    Int = usgn ? Intrinsic::arm_neon_vminu : Intrinsic::arm_neon_vmins;
16688dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vmin");
1669537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vmovl_v: {
16702acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *DTy =llvm::VectorType::getTruncatedElementVectorType(VTy);
16712235941293353325835d182da4470f61828fe789Bob Wilson    Ops[0] = Builder.CreateBitCast(Ops[0], DTy);
16727cea322bf019b0d38867a27e20e3771d84dbb1afBob Wilson    if (usgn)
16737cea322bf019b0d38867a27e20e3771d84dbb1afBob Wilson      return Builder.CreateZExt(Ops[0], Ty, "vmovl");
16747cea322bf019b0d38867a27e20e3771d84dbb1afBob Wilson    return Builder.CreateSExt(Ops[0], Ty, "vmovl");
16752235941293353325835d182da4470f61828fe789Bob Wilson  }
1676537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vmovn_v: {
16772acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *QTy = llvm::VectorType::getExtendedElementVectorType(VTy);
16782235941293353325835d182da4470f61828fe789Bob Wilson    Ops[0] = Builder.CreateBitCast(Ops[0], QTy);
16793b6081bf49b7506cb96131247f209d1e03610df8Bob Wilson    return Builder.CreateTrunc(Ops[0], Ty, "vmovn");
16802235941293353325835d182da4470f61828fe789Bob Wilson  }
1681537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vmul_v:
1682537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vmulq_v:
1683da95f73b59f9af964e33725c515139d34c90c863Bob Wilson    assert(Type.isPoly() && "vmul builtin only supported for polynomial types");
16848dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vmulp, Ty),
1685953d513c7ee79b3d9e37597e64317e75c0fbf7f6Bob Wilson                        Ops, "vmul");
1686537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vmull_v:
16872d33e423d5091b7d2cb8618952752abd55bba965Bob Wilson    Int = usgn ? Intrinsic::arm_neon_vmullu : Intrinsic::arm_neon_vmulls;
1688da95f73b59f9af964e33725c515139d34c90c863Bob Wilson    Int = Type.isPoly() ? (unsigned)Intrinsic::arm_neon_vmullp : Int;
16898dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vmull");
1690537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vpadal_v:
1691537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vpadalq_v: {
1692df98e1d1da5ab1ca7c325378fc1c2eaa90a6476dNate Begeman    Int = usgn ? Intrinsic::arm_neon_vpadalu : Intrinsic::arm_neon_vpadals;
1693c1fa01b69d9377a69087a6006a65a8fcc526d565Bob Wilson    // The source operand type has twice as many elements of half the size.
1694c1fa01b69d9377a69087a6006a65a8fcc526d565Bob Wilson    unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
16952acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *EltTy =
1696d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall      llvm::IntegerType::get(getLLVMContext(), EltBits / 2);
16979cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *NarrowTy =
1698c1fa01b69d9377a69087a6006a65a8fcc526d565Bob Wilson      llvm::VectorType::get(EltTy, VTy->getNumElements() * 2);
16999cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *Tys[2] = { Ty, NarrowTy };
17008dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Tys), Ops, "vpadal");
1701c1fa01b69d9377a69087a6006a65a8fcc526d565Bob Wilson  }
1702537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vpadd_v:
17038dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vpadd, Ty),
1704548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman                        Ops, "vpadd");
1705537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vpaddl_v:
1706537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vpaddlq_v: {
1707548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vpaddlu : Intrinsic::arm_neon_vpaddls;
1708c1fa01b69d9377a69087a6006a65a8fcc526d565Bob Wilson    // The source operand type has twice as many elements of half the size.
1709c1fa01b69d9377a69087a6006a65a8fcc526d565Bob Wilson    unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
17102acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *EltTy = llvm::IntegerType::get(getLLVMContext(), EltBits / 2);
17119cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *NarrowTy =
1712c1fa01b69d9377a69087a6006a65a8fcc526d565Bob Wilson      llvm::VectorType::get(EltTy, VTy->getNumElements() * 2);
17139cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    llvm::Type *Tys[2] = { Ty, NarrowTy };
17148dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Tys), Ops, "vpaddl");
1715c1fa01b69d9377a69087a6006a65a8fcc526d565Bob Wilson  }
1716537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vpmax_v:
1717548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vpmaxu : Intrinsic::arm_neon_vpmaxs;
17188dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vpmax");
1719537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vpmin_v:
1720548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vpminu : Intrinsic::arm_neon_vpmins;
17218dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vpmin");
1722537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqabs_v:
1723537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqabsq_v:
17248dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vqabs, Ty),
1725548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman                        Ops, "vqabs");
1726537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqadd_v:
1727537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqaddq_v:
1728548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vqaddu : Intrinsic::arm_neon_vqadds;
17298dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vqadd");
1730537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqdmlal_v:
17318dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vqdmlal, Ty),
1732db3d4d036037f379f12643e067b229862d61e932Bob Wilson                        Ops, "vqdmlal");
1733537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqdmlsl_v:
17348dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vqdmlsl, Ty),
1735db3d4d036037f379f12643e067b229862d61e932Bob Wilson                        Ops, "vqdmlsl");
1736537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqdmulh_v:
1737537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqdmulhq_v:
17388dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vqdmulh, Ty),
1739db3d4d036037f379f12643e067b229862d61e932Bob Wilson                        Ops, "vqdmulh");
1740537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqdmull_v:
17418dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vqdmull, Ty),
1742db3d4d036037f379f12643e067b229862d61e932Bob Wilson                        Ops, "vqdmull");
1743537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqmovn_v:
1744548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vqmovnu : Intrinsic::arm_neon_vqmovns;
17458dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vqmovn");
1746537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqmovun_v:
17478dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vqmovnsu, Ty),
1748548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman                        Ops, "vqdmull");
1749537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqneg_v:
1750537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqnegq_v:
17518dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vqneg, Ty),
175261eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman                        Ops, "vqneg");
1753537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqrdmulh_v:
1754537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqrdmulhq_v:
17558dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vqrdmulh, Ty),
1756db3d4d036037f379f12643e067b229862d61e932Bob Wilson                        Ops, "vqrdmulh");
1757537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqrshl_v:
1758537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqrshlq_v:
1759548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vqrshiftu : Intrinsic::arm_neon_vqrshifts;
17608dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vqrshl");
1761537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqrshrn_n_v:
1762548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vqrshiftnu : Intrinsic::arm_neon_vqrshiftns;
17638dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vqrshrn_n",
176461eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman                        1, true);
1765537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqrshrun_n_v:
17668dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vqrshiftnsu, Ty),
1767db3d4d036037f379f12643e067b229862d61e932Bob Wilson                        Ops, "vqrshrun_n", 1, true);
1768537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqshl_v:
1769537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqshlq_v:
177061eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman    Int = usgn ? Intrinsic::arm_neon_vqshiftu : Intrinsic::arm_neon_vqshifts;
17718dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vqshl");
1772537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqshl_n_v:
1773537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqshlq_n_v:
177461eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman    Int = usgn ? Intrinsic::arm_neon_vqshiftu : Intrinsic::arm_neon_vqshifts;
17758dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vqshl_n",
177661eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman                        1, false);
1777537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqshlu_n_v:
1778537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqshluq_n_v:
17798dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vqshiftsu, Ty),
1780db3d4d036037f379f12643e067b229862d61e932Bob Wilson                        Ops, "vqshlu", 1, false);
1781537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqshrn_n_v:
178261eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman    Int = usgn ? Intrinsic::arm_neon_vqshiftnu : Intrinsic::arm_neon_vqshiftns;
17838dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vqshrn_n",
178461eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman                        1, true);
1785537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqshrun_n_v:
17868dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vqshiftnsu, Ty),
1787db3d4d036037f379f12643e067b229862d61e932Bob Wilson                        Ops, "vqshrun_n", 1, true);
1788537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqsub_v:
1789537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vqsubq_v:
1790464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vqsubu : Intrinsic::arm_neon_vqsubs;
17918dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vqsub");
1792537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vraddhn_v:
17938dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vraddhn, Ty),
1794464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                        Ops, "vraddhn");
1795537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrecpe_v:
1796537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrecpeq_v:
17978dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vrecpe, Ty),
1798464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                        Ops, "vrecpe");
1799537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrecps_v:
1800537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrecpsq_v:
18018dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vrecps, Ty),
1802464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                        Ops, "vrecps");
1803537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrhadd_v:
1804537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrhaddq_v:
1805464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vrhaddu : Intrinsic::arm_neon_vrhadds;
18068dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vrhadd");
1807537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrshl_v:
1808537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrshlq_v:
18095af93efc01f4acd247aa6d3124db6c92c3679198Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vrshiftu : Intrinsic::arm_neon_vrshifts;
18108dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vrshl");
1811537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrshrn_n_v:
18128dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vrshiftn, Ty),
1813db3d4d036037f379f12643e067b229862d61e932Bob Wilson                        Ops, "vrshrn_n", 1, true);
1814537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrshr_n_v:
1815537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrshrq_n_v:
18165af93efc01f4acd247aa6d3124db6c92c3679198Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vrshiftu : Intrinsic::arm_neon_vrshifts;
18178dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vrshr_n", 1, true);
1818537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrsqrte_v:
1819537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrsqrteq_v:
18208dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vrsqrte, Ty),
18215af93efc01f4acd247aa6d3124db6c92c3679198Nate Begeman                        Ops, "vrsqrte");
1822537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrsqrts_v:
1823537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrsqrtsq_v:
18248dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vrsqrts, Ty),
18255af93efc01f4acd247aa6d3124db6c92c3679198Nate Begeman                        Ops, "vrsqrts");
1826537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrsra_n_v:
1827537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrsraq_n_v:
18285af93efc01f4acd247aa6d3124db6c92c3679198Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
18295af93efc01f4acd247aa6d3124db6c92c3679198Nate Begeman    Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
18305af93efc01f4acd247aa6d3124db6c92c3679198Nate Begeman    Ops[2] = EmitNeonShiftVector(Ops[2], Ty, true);
18315af93efc01f4acd247aa6d3124db6c92c3679198Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vrshiftu : Intrinsic::arm_neon_vrshifts;
18328dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    Ops[1] = Builder.CreateCall2(CGM.getIntrinsic(Int, Ty), Ops[1], Ops[2]);
18335af93efc01f4acd247aa6d3124db6c92c3679198Nate Begeman    return Builder.CreateAdd(Ops[0], Ops[1], "vrsra_n");
1834537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vrsubhn_v:
18358dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vrsubhn, Ty),
1836464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                        Ops, "vrsubhn");
1837537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vshl_v:
1838537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vshlq_v:
1839464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vshiftu : Intrinsic::arm_neon_vshifts;
18408dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vshl");
1841537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vshll_n_v:
1842464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    Int = usgn ? Intrinsic::arm_neon_vshiftlu : Intrinsic::arm_neon_vshiftls;
18438dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vshll", 1);
1844537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vshl_n_v:
1845537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vshlq_n_v:
184661eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman    Ops[1] = EmitNeonShiftVector(Ops[1], Ty, false);
184761eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman    return Builder.CreateShl(Builder.CreateBitCast(Ops[0],Ty), Ops[1], "vshl_n");
1848537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vshrn_n_v:
18498dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vshiftn, Ty),
1850db3d4d036037f379f12643e067b229862d61e932Bob Wilson                        Ops, "vshrn_n", 1, true);
1851537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vshr_n_v:
1852537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vshrq_n_v:
1853464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
185461eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman    Ops[1] = EmitNeonShiftVector(Ops[1], Ty, false);
1855464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    if (usgn)
1856464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman      return Builder.CreateLShr(Ops[0], Ops[1], "vshr_n");
1857464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    else
1858464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman      return Builder.CreateAShr(Ops[0], Ops[1], "vshr_n");
1859537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vsri_n_v:
1860537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vsriq_n_v:
18617965396d8d6ac23ec4c4f9d01d216f2e73d7fc72Bob Wilson    rightShift = true;
1862537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vsli_n_v:
1863537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vsliq_n_v:
18647965396d8d6ac23ec4c4f9d01d216f2e73d7fc72Bob Wilson    Ops[2] = EmitNeonShiftVector(Ops[2], Ty, rightShift);
18658dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vshiftins, Ty),
1866464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                        Ops, "vsli_n");
1867537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vsra_n_v:
1868537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vsraq_n_v:
1869464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
1870464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
187161eecf5aea018ea65c9ab0bccacd2996b15c632dNate Begeman    Ops[2] = EmitNeonShiftVector(Ops[2], Ty, false);
1872464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    if (usgn)
1873464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman      Ops[1] = Builder.CreateLShr(Ops[1], Ops[2], "vsra_n");
1874464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    else
1875464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman      Ops[1] = Builder.CreateAShr(Ops[1], Ops[2], "vsra_n");
1876464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    return Builder.CreateAdd(Ops[0], Ops[1]);
1877537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst1_v:
1878537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst1q_v:
187906b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
18808dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst1, Ty),
1881464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                        Ops, "");
1882537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst1_lane_v:
1883eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson  case ARM::BI__builtin_neon_vst1q_lane_v: {
1884464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
1885464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    Ops[1] = Builder.CreateExtractElement(Ops[1], Ops[2]);
1886464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman    Ty = llvm::PointerType::getUnqual(Ops[1]->getType());
1887eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson    StoreInst *St = Builder.CreateStore(Ops[1],
1888eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson                                        Builder.CreateBitCast(Ops[0], Ty));
1889eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson    Value *Align = GetPointeeAlignment(*this, E->getArg(0));
1890eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson    St->setAlignment(cast<ConstantInt>(Align)->getZExtValue());
1891eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson    return St;
1892eac1f6746a2915fea3ed42284b07e274c0095a95Bob Wilson  }
1893537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst2_v:
1894537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst2q_v:
189506b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
18968dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst2, Ty),
1897464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                        Ops, "");
1898537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst2_lane_v:
1899537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst2q_lane_v:
190006b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
19018dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst2lane, Ty),
1902464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                        Ops, "");
1903537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst3_v:
1904537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst3q_v:
190506b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
19068dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst3, Ty),
1907464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                        Ops, "");
1908537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst3_lane_v:
1909537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst3q_lane_v:
191006b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
19118dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst3lane, Ty),
1912464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                        Ops, "");
1913537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst4_v:
1914537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst4q_v:
191506b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
19168dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst4, Ty),
1917464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                        Ops, "");
1918537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst4_lane_v:
1919537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vst4q_lane_v:
192006b6c589a5fff8e5476fe2b4cd6a660af71bfdddBob Wilson    Ops.push_back(GetPointeeAlignment(*this, E->getArg(0)));
19218dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vst4lane, Ty),
1922464ccb68f22a7e1c0a2844551c16f721540c91c3Nate Begeman                        Ops, "");
1923537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vsubhn_v:
19248dd55a3c3b28d195717c87bbc60e765951d408feBenjamin Kramer    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vsubhn, Ty),
1925548f7daa59012df2e20420e86c2722d19367ef17Nate Begeman                        Ops, "vsubhn");
1926537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vtbl1_v:
19271c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vtbl1),
19281c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman                        Ops, "vtbl1");
1929537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vtbl2_v:
19301c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vtbl2),
19311c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman                        Ops, "vtbl2");
1932537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vtbl3_v:
19331c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vtbl3),
19341c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman                        Ops, "vtbl3");
1935537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vtbl4_v:
19361c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vtbl4),
19371c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman                        Ops, "vtbl4");
1938537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vtbx1_v:
19391c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vtbx1),
19401c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman                        Ops, "vtbx1");
1941537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vtbx2_v:
19421c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vtbx2),
19431c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman                        Ops, "vtbx2");
1944537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vtbx3_v:
19451c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vtbx3),
19461c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman                        Ops, "vtbx3");
1947537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vtbx4_v:
19481c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    return EmitNeonCall(CGM.getIntrinsic(Intrinsic::arm_neon_vtbx4),
19491c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman                        Ops, "vtbx4");
1950537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vtst_v:
1951537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vtstq_v: {
19521c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
19531c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
19541c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    Ops[0] = Builder.CreateAnd(Ops[0], Ops[1]);
19551c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    Ops[0] = Builder.CreateICmp(ICmpInst::ICMP_NE, Ops[0],
19561c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman                                ConstantAggregateZero::get(Ty));
19571c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    return Builder.CreateSExt(Ops[0], Ty, "vtst");
19581c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman  }
1959537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vtrn_v:
1960537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vtrnq_v: {
19614be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], llvm::PointerType::getUnqual(Ty));
19624be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
19634be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[2] = Builder.CreateBitCast(Ops[2], Ty);
19649577abc63f2c7afe5adf6e4e101ae91d29c3b8a6Ted Kremenek    Value *SV = 0;
19654be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman
19661c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    for (unsigned vi = 0; vi != 2; ++vi) {
19674be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      SmallVector<Constant*, 16> Indices;
19684be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      for (unsigned i = 0, e = VTy->getNumElements(); i != e; i += 2) {
19692ce8842641cc312628c4be836d34eb250e7c3f78Chris Lattner        Indices.push_back(Builder.getInt32(i+vi));
19702ce8842641cc312628c4be836d34eb250e7c3f78Chris Lattner        Indices.push_back(Builder.getInt32(i+e+vi));
19711c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman      }
19724be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      Value *Addr = Builder.CreateConstInBoundsGEP1_32(Ops[0], vi);
1973fb018d153cbf12fd2a4a278cbf7614b9a2e2835eChris Lattner      SV = llvm::ConstantVector::get(Indices);
19744be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      SV = Builder.CreateShuffleVector(Ops[1], Ops[2], SV, "vtrn");
19754be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      SV = Builder.CreateStore(SV, Addr);
19761c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    }
19774be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    return SV;
19781c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman  }
1979537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vuzp_v:
1980537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vuzpq_v: {
19814be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], llvm::PointerType::getUnqual(Ty));
19821c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
19834be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[2] = Builder.CreateBitCast(Ops[2], Ty);
19849577abc63f2c7afe5adf6e4e101ae91d29c3b8a6Ted Kremenek    Value *SV = 0;
19854be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman
19864be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    for (unsigned vi = 0; vi != 2; ++vi) {
19874be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      SmallVector<Constant*, 16> Indices;
19884be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i)
198977b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner        Indices.push_back(ConstantInt::get(Int32Ty, 2*i+vi));
19904be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman
19914be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      Value *Addr = Builder.CreateConstInBoundsGEP1_32(Ops[0], vi);
1992fb018d153cbf12fd2a4a278cbf7614b9a2e2835eChris Lattner      SV = llvm::ConstantVector::get(Indices);
19934be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      SV = Builder.CreateShuffleVector(Ops[1], Ops[2], SV, "vuzp");
19944be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      SV = Builder.CreateStore(SV, Addr);
19954be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    }
19964be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    return SV;
19971c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman  }
1998537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vzip_v:
1999537c3461166ce074d05fb7c96ffa98ed54c9aaa0Bob Wilson  case ARM::BI__builtin_neon_vzipq_v: {
20004be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], llvm::PointerType::getUnqual(Ty));
20011c2a88cfaeb11227d3a6bf7204207e0c8cf6de6fNate Begeman    Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
20024be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    Ops[2] = Builder.CreateBitCast(Ops[2], Ty);
20039577abc63f2c7afe5adf6e4e101ae91d29c3b8a6Ted Kremenek    Value *SV = 0;
20044be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman
20054be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    for (unsigned vi = 0; vi != 2; ++vi) {
20064be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      SmallVector<Constant*, 16> Indices;
20074be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      for (unsigned i = 0, e = VTy->getNumElements(); i != e; i += 2) {
2008e361cc3daa6c22e4413d48bd8b8934ea9fd5a55fDaniel Dunbar        Indices.push_back(ConstantInt::get(Int32Ty, (i + vi*e) >> 1));
2009e361cc3daa6c22e4413d48bd8b8934ea9fd5a55fDaniel Dunbar        Indices.push_back(ConstantInt::get(Int32Ty, ((i + vi*e) >> 1)+e));
20104be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      }
20114be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      Value *Addr = Builder.CreateConstInBoundsGEP1_32(Ops[0], vi);
2012fb018d153cbf12fd2a4a278cbf7614b9a2e2835eChris Lattner      SV = llvm::ConstantVector::get(Indices);
20134be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      SV = Builder.CreateShuffleVector(Ops[1], Ops[2], SV, "vzip");
20144be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman      SV = Builder.CreateStore(SV, Addr);
20154be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    }
20164be54302da40d3e7cba3d93115f312d2fcca1879Nate Begeman    return SV;
20179eb65a56e18bee1e5392bf2dff01cbd7b895f685Nate Begeman  }
20182752c0137d95aa2f4ee1cdff4b564bac842e041bChris Lattner  }
20192752c0137d95aa2f4ee1cdff4b564bac842e041bChris Lattner}
20202752c0137d95aa2f4ee1cdff4b564bac842e041bChris Lattner
2021aa51e513850688b7963efc62abf1eface7037602Bill Wendlingllvm::Value *CodeGenFunction::
20225f9e272e632e951b1efe824cd16acb4d96077930Chris LattnerBuildVector(const SmallVectorImpl<llvm::Value*> &Ops) {
2023aa51e513850688b7963efc62abf1eface7037602Bill Wendling  assert((Ops.size() & (Ops.size() - 1)) == 0 &&
2024aa51e513850688b7963efc62abf1eface7037602Bill Wendling         "Not a power-of-two sized vector!");
2025aa51e513850688b7963efc62abf1eface7037602Bill Wendling  bool AllConstants = true;
2026aa51e513850688b7963efc62abf1eface7037602Bill Wendling  for (unsigned i = 0, e = Ops.size(); i != e && AllConstants; ++i)
2027aa51e513850688b7963efc62abf1eface7037602Bill Wendling    AllConstants &= isa<Constant>(Ops[i]);
2028aa51e513850688b7963efc62abf1eface7037602Bill Wendling
2029aa51e513850688b7963efc62abf1eface7037602Bill Wendling  // If this is a constant vector, create a ConstantVector.
2030aa51e513850688b7963efc62abf1eface7037602Bill Wendling  if (AllConstants) {
20312ce8842641cc312628c4be836d34eb250e7c3f78Chris Lattner    SmallVector<llvm::Constant*, 16> CstOps;
2032aa51e513850688b7963efc62abf1eface7037602Bill Wendling    for (unsigned i = 0, e = Ops.size(); i != e; ++i)
2033aa51e513850688b7963efc62abf1eface7037602Bill Wendling      CstOps.push_back(cast<Constant>(Ops[i]));
2034aa51e513850688b7963efc62abf1eface7037602Bill Wendling    return llvm::ConstantVector::get(CstOps);
2035aa51e513850688b7963efc62abf1eface7037602Bill Wendling  }
2036aa51e513850688b7963efc62abf1eface7037602Bill Wendling
2037aa51e513850688b7963efc62abf1eface7037602Bill Wendling  // Otherwise, insertelement the values to build the vector.
2038aa51e513850688b7963efc62abf1eface7037602Bill Wendling  Value *Result =
2039aa51e513850688b7963efc62abf1eface7037602Bill Wendling    llvm::UndefValue::get(llvm::VectorType::get(Ops[0]->getType(), Ops.size()));
2040aa51e513850688b7963efc62abf1eface7037602Bill Wendling
2041aa51e513850688b7963efc62abf1eface7037602Bill Wendling  for (unsigned i = 0, e = Ops.size(); i != e; ++i)
20422ce8842641cc312628c4be836d34eb250e7c3f78Chris Lattner    Result = Builder.CreateInsertElement(Result, Ops[i], Builder.getInt32(i));
2043aa51e513850688b7963efc62abf1eface7037602Bill Wendling
2044aa51e513850688b7963efc62abf1eface7037602Bill Wendling  return Result;
2045aa51e513850688b7963efc62abf1eface7037602Bill Wendling}
2046aa51e513850688b7963efc62abf1eface7037602Bill Wendling
20471eb4433ac451dc16f4133a88af2d002ac26c58efMike StumpValue *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
20481feedd84221e8dbcc3faf3de27cc42b559db845dChris Lattner                                           const CallExpr *E) {
20495f9e272e632e951b1efe824cd16acb4d96077930Chris Lattner  SmallVector<Value*, 4> Ops;
20502929cfa9b7df1d5b0571b54161783e4d791a0b77Anders Carlsson
205146c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner  // Find out if any arguments are required to be integer constant expressions.
205246c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner  unsigned ICEArguments = 0;
205346c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner  ASTContext::GetBuiltinTypeError Error;
205446c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner  getContext().GetBuiltinType(BuiltinID, Error, &ICEArguments);
205546c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner  assert(Error == ASTContext::GE_None && "Should not codegen an error");
205646c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner
205746c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner  for (unsigned i = 0, e = E->getNumArgs(); i != e; i++) {
205846c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    // If this is a normal argument, just emit it as a scalar.
205946c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    if ((ICEArguments & (1 << i)) == 0) {
206046c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner      Ops.push_back(EmitScalarExpr(E->getArg(i)));
206146c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner      continue;
206246c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    }
206346c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner
206446c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    // If this is required to be a constant, constant fold it so that we know
206546c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    // that the generated intrinsic gets a ConstantInt.
206646c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    llvm::APSInt Result;
206746c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    bool IsConst = E->getArg(i)->isIntegerConstantExpr(Result, getContext());
206846c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner    assert(IsConst && "Constant arg isn't actually constant?"); (void)IsConst;
2069d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    Ops.push_back(llvm::ConstantInt::get(getLLVMContext(), Result));
207046c5591f0fa2e35367e44234e59bb041d15b778eChris Lattner  }
20712929cfa9b7df1d5b0571b54161783e4d791a0b77Anders Carlsson
2072564f1de67d7ba43646b8740db86d6269e3dfbe0bAnders Carlsson  switch (BuiltinID) {
207346a26b0b0e2ec1557bad9b70e8e20836524ebdfcAnders Carlsson  default: return 0;
2074aa51e513850688b7963efc62abf1eface7037602Bill Wendling  case X86::BI__builtin_ia32_vec_init_v8qi:
2075aa51e513850688b7963efc62abf1eface7037602Bill Wendling  case X86::BI__builtin_ia32_vec_init_v4hi:
2076aa51e513850688b7963efc62abf1eface7037602Bill Wendling  case X86::BI__builtin_ia32_vec_init_v2si:
2077aa51e513850688b7963efc62abf1eface7037602Bill Wendling    return Builder.CreateBitCast(BuildVector(Ops),
2078d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall                                 llvm::Type::getX86_MMXTy(getLLVMContext()));
20791944ec188408aff1931c62c79a069e30f2549ec2Argyrios Kyrtzidis  case X86::BI__builtin_ia32_vec_ext_v2si:
20801944ec188408aff1931c62c79a069e30f2549ec2Argyrios Kyrtzidis    return Builder.CreateExtractElement(Ops[0],
20811944ec188408aff1931c62c79a069e30f2549ec2Argyrios Kyrtzidis                                  llvm::ConstantInt::get(Ops[1]->getType(), 0));
2082e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman  case X86::BI__builtin_ia32_ldmxcsr: {
20832acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *PtrTy = Int8PtrTy;
208477b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner    Value *One = llvm::ConstantInt::get(Int32Ty, 1);
2085578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    Value *Tmp = Builder.CreateAlloca(Int32Ty, One);
2086e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman    Builder.CreateStore(Ops[0], Tmp);
2087e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman    return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_sse_ldmxcsr),
20883eae03e7d165f20a863a9a4d7122ba2a691ab16dChris Lattner                              Builder.CreateBitCast(Tmp, PtrTy));
2089e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman  }
2090e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman  case X86::BI__builtin_ia32_stmxcsr: {
20912acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner    llvm::Type *PtrTy = Int8PtrTy;
209277b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner    Value *One = llvm::ConstantInt::get(Int32Ty, 1);
2093578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    Value *Tmp = Builder.CreateAlloca(Int32Ty, One);
2094012614ecf78442368ec82ee30efb3bc047b413e6Ted Kremenek    Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_sse_stmxcsr),
2095012614ecf78442368ec82ee30efb3bc047b413e6Ted Kremenek                       Builder.CreateBitCast(Tmp, PtrTy));
2096e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman    return Builder.CreateLoad(Tmp, "stmxcsr");
2097e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman  }
2098e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman  case X86::BI__builtin_ia32_storehps:
2099e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman  case X86::BI__builtin_ia32_storelps: {
210077b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner    llvm::Type *PtrTy = llvm::PointerType::getUnqual(Int64Ty);
210177b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner    llvm::Type *VecTy = llvm::VectorType::get(Int64Ty, 2);
21021eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2103e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman    // cast val v2i64
2104e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman    Ops[1] = Builder.CreateBitCast(Ops[1], VecTy, "cast");
21051eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2106e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman    // extract (0, 1)
2107e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman    unsigned Index = BuiltinID == X86::BI__builtin_ia32_storelps ? 0 : 1;
210877b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner    llvm::Value *Idx = llvm::ConstantInt::get(Int32Ty, Index);
2109e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman    Ops[1] = Builder.CreateExtractElement(Ops[1], Idx, "extract");
2110e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman
2111e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman    // cast pointer to i64 & store
2112e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman    Ops[0] = Builder.CreateBitCast(Ops[0], PtrTy);
2113e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman    return Builder.CreateStore(Ops[1], Ops[0]);
2114e7722103abc4583366c914374d6aa8560e145fa1Nate Begeman  }
211528cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling  case X86::BI__builtin_ia32_palignr: {
211628cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling    unsigned shiftVal = cast<llvm::ConstantInt>(Ops[2])->getZExtValue();
211728cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling
211828cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling    // If palignr is shifting the pair of input vectors less than 9 bytes,
211928cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling    // emit a shuffle instruction.
212028cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling    if (shiftVal <= 8) {
21215f9e272e632e951b1efe824cd16acb4d96077930Chris Lattner      SmallVector<llvm::Constant*, 8> Indices;
212228cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling      for (unsigned i = 0; i != 8; ++i)
212328cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling        Indices.push_back(llvm::ConstantInt::get(Int32Ty, shiftVal + i));
212428cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling
2125fb018d153cbf12fd2a4a278cbf7614b9a2e2835eChris Lattner      Value* SV = llvm::ConstantVector::get(Indices);
212628cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling      return Builder.CreateShuffleVector(Ops[1], Ops[0], SV, "palignr");
212728cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling    }
212828cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling
212928cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling    // If palignr is shifting the pair of input vectors more than 8 but less
213028cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling    // than 16 bytes, emit a logical right shift of the destination.
213128cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling    if (shiftVal < 16) {
213228cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling      // MMX has these as 1 x i64 vectors for some odd optimization reasons.
21332acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner      llvm::Type *VecTy = llvm::VectorType::get(Int64Ty, 1);
213428cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling
213528cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling      Ops[0] = Builder.CreateBitCast(Ops[0], VecTy, "cast");
213628cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling      Ops[1] = llvm::ConstantInt::get(VecTy, (shiftVal-8) * 8);
213728cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling
213828cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling      // create i32 constant
213928cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling      llvm::Function *F = CGM.getIntrinsic(Intrinsic::x86_mmx_psrl_q);
2140e9c0265d6e6b5bf865f4a0c2c00d00ac251e6437Frits van Bommel      return Builder.CreateCall(F, makeArrayRef(&Ops[0], 2), "palignr");
214128cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling    }
214228cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling
21435c22ad2ef6bf39da22d5190025e0ddfd4b568b2aEli Friedman    // If palignr is shifting the pair of vectors more than 16 bytes, emit zero.
214428cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling    return llvm::Constant::getNullValue(ConvertType(E->getType()));
214528cab383fd9e7647d2186340eca769303cc4fbdbBill Wendling  }
2146c3420ffb282c6ffc0192013bf8045b6c21eddeceNate Begeman  case X86::BI__builtin_ia32_palignr128: {
2147ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman    unsigned shiftVal = cast<llvm::ConstantInt>(Ops[2])->getZExtValue();
2148ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman
2149ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman    // If palignr is shifting the pair of input vectors less than 17 bytes,
2150ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman    // emit a shuffle instruction.
2151ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman    if (shiftVal <= 16) {
21525f9e272e632e951b1efe824cd16acb4d96077930Chris Lattner      SmallVector<llvm::Constant*, 16> Indices;
2153ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman      for (unsigned i = 0; i != 16; ++i)
215477b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner        Indices.push_back(llvm::ConstantInt::get(Int32Ty, shiftVal + i));
2155ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman
2156fb018d153cbf12fd2a4a278cbf7614b9a2e2835eChris Lattner      Value* SV = llvm::ConstantVector::get(Indices);
2157ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman      return Builder.CreateShuffleVector(Ops[1], Ops[0], SV, "palignr");
2158ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman    }
2159ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman
2160ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman    // If palignr is shifting the pair of input vectors more than 16 but less
2161ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman    // than 32 bytes, emit a logical right shift of the destination.
2162ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman    if (shiftVal < 32) {
21632acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2dChris Lattner      llvm::Type *VecTy = llvm::VectorType::get(Int64Ty, 2);
2164ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman
2165ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman      Ops[0] = Builder.CreateBitCast(Ops[0], VecTy, "cast");
216677b89b87c3b9220fea1bc80f6d6598d2003cc8a8Chris Lattner      Ops[1] = llvm::ConstantInt::get(Int32Ty, (shiftVal-16) * 8);
2167ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman
2168ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman      // create i32 constant
2169ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman      llvm::Function *F = CGM.getIntrinsic(Intrinsic::x86_sse2_psrl_dq);
2170e9c0265d6e6b5bf865f4a0c2c00d00ac251e6437Frits van Bommel      return Builder.CreateCall(F, makeArrayRef(&Ops[0], 2), "palignr");
2171ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman    }
2172ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman
2173ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman    // If palignr is shifting the pair of vectors more than 32 bytes, emit zero.
2174ce5818a19a8f77d1540d0352649d6687eca4af6bNate Begeman    return llvm::Constant::getNullValue(ConvertType(E->getType()));
217591b59274439f776cdd545bd7bf5849fdb1842160Eric Christopher  }
21769c2ffd803af03f1728423d0d73ff87d988642633Craig Topper  case X86::BI__builtin_ia32_palignr256: {
21779c2ffd803af03f1728423d0d73ff87d988642633Craig Topper    unsigned shiftVal = cast<llvm::ConstantInt>(Ops[2])->getZExtValue();
21789c2ffd803af03f1728423d0d73ff87d988642633Craig Topper
21799c2ffd803af03f1728423d0d73ff87d988642633Craig Topper    // If palignr is shifting the pair of input vectors less than 17 bytes,
21809c2ffd803af03f1728423d0d73ff87d988642633Craig Topper    // emit a shuffle instruction.
21819c2ffd803af03f1728423d0d73ff87d988642633Craig Topper    if (shiftVal <= 16) {
21829c2ffd803af03f1728423d0d73ff87d988642633Craig Topper      SmallVector<llvm::Constant*, 32> Indices;
21839c2ffd803af03f1728423d0d73ff87d988642633Craig Topper      // 256-bit palignr operates on 128-bit lanes so we need to handle that
21849c2ffd803af03f1728423d0d73ff87d988642633Craig Topper      for (unsigned l = 0; l != 2; ++l) {
21859c2ffd803af03f1728423d0d73ff87d988642633Craig Topper        unsigned LaneStart = l * 16;
21869c2ffd803af03f1728423d0d73ff87d988642633Craig Topper        unsigned LaneEnd = (l+1) * 16;
21879c2ffd803af03f1728423d0d73ff87d988642633Craig Topper        for (unsigned i = 0; i != 16; ++i) {
21889c2ffd803af03f1728423d0d73ff87d988642633Craig Topper          unsigned Idx = shiftVal + i + LaneStart;
21899c2ffd803af03f1728423d0d73ff87d988642633Craig Topper          if (Idx >= LaneEnd) Idx += 16; // end of lane, switch operand
21909c2ffd803af03f1728423d0d73ff87d988642633Craig Topper          Indices.push_back(llvm::ConstantInt::get(Int32Ty, Idx));
21919c2ffd803af03f1728423d0d73ff87d988642633Craig Topper        }
21929c2ffd803af03f1728423d0d73ff87d988642633Craig Topper      }
21939c2ffd803af03f1728423d0d73ff87d988642633Craig Topper
21949c2ffd803af03f1728423d0d73ff87d988642633Craig Topper      Value* SV = llvm::ConstantVector::get(Indices);
21959c2ffd803af03f1728423d0d73ff87d988642633Craig Topper      return Builder.CreateShuffleVector(Ops[1], Ops[0], SV, "palignr");
21969c2ffd803af03f1728423d0d73ff87d988642633Craig Topper    }
21979c2ffd803af03f1728423d0d73ff87d988642633Craig Topper
21989c2ffd803af03f1728423d0d73ff87d988642633Craig Topper    // If palignr is shifting the pair of input vectors more than 16 but less
21999c2ffd803af03f1728423d0d73ff87d988642633Craig Topper    // than 32 bytes, emit a logical right shift of the destination.
22009c2ffd803af03f1728423d0d73ff87d988642633Craig Topper    if (shiftVal < 32) {
22019c2ffd803af03f1728423d0d73ff87d988642633Craig Topper      llvm::Type *VecTy = llvm::VectorType::get(Int64Ty, 4);
22029c2ffd803af03f1728423d0d73ff87d988642633Craig Topper
22039c2ffd803af03f1728423d0d73ff87d988642633Craig Topper      Ops[0] = Builder.CreateBitCast(Ops[0], VecTy, "cast");
22049c2ffd803af03f1728423d0d73ff87d988642633Craig Topper      Ops[1] = llvm::ConstantInt::get(Int32Ty, (shiftVal-16) * 8);
22059c2ffd803af03f1728423d0d73ff87d988642633Craig Topper
22069c2ffd803af03f1728423d0d73ff87d988642633Craig Topper      // create i32 constant
22079c2ffd803af03f1728423d0d73ff87d988642633Craig Topper      llvm::Function *F = CGM.getIntrinsic(Intrinsic::x86_avx2_psrl_dq);
22089c2ffd803af03f1728423d0d73ff87d988642633Craig Topper      return Builder.CreateCall(F, makeArrayRef(&Ops[0], 2), "palignr");
22099c2ffd803af03f1728423d0d73ff87d988642633Craig Topper    }
22109c2ffd803af03f1728423d0d73ff87d988642633Craig Topper
22119c2ffd803af03f1728423d0d73ff87d988642633Craig Topper    // If palignr is shifting the pair of vectors more than 32 bytes, emit zero.
22129c2ffd803af03f1728423d0d73ff87d988642633Craig Topper    return llvm::Constant::getNullValue(ConvertType(E->getType()));
22139c2ffd803af03f1728423d0d73ff87d988642633Craig Topper  }
2214b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling  case X86::BI__builtin_ia32_movntps:
2215b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling  case X86::BI__builtin_ia32_movntpd:
2216b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling  case X86::BI__builtin_ia32_movntdq:
2217b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling  case X86::BI__builtin_ia32_movnti: {
2218b107dd02f5e365f60b036b8a27c784f2d0d0a855Bill Wendling    llvm::MDNode *Node = llvm::MDNode::get(getLLVMContext(),
2219b107dd02f5e365f60b036b8a27c784f2d0d0a855Bill Wendling                                           Builder.getInt32(1));
2220b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling
2221b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling    // Convert the type of the pointer to a pointer to the stored type.
2222b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling    Value *BC = Builder.CreateBitCast(Ops[0],
2223b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling                                llvm::PointerType::getUnqual(Ops[1]->getType()),
2224b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling                                      "cast");
2225b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling    StoreInst *SI = Builder.CreateStore(Ops[1], BC);
2226b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling    SI->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
2227b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling    SI->setAlignment(16);
2228b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling    return SI;
2229b51bddab211ba7daa8832c017d82281e0d8348d1Bill Wendling  }
22308b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer  // 3DNow!
22318b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer  case X86::BI__builtin_ia32_pswapdsf:
22328b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer  case X86::BI__builtin_ia32_pswapdsi: {
22338b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer    const char *name = 0;
22348b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer    Intrinsic::ID ID = Intrinsic::not_intrinsic;
22358b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer    switch(BuiltinID) {
2236f8495d67ca4dd2ea15a4dc59e9a2fa32a9bfa475Craig Topper    default: llvm_unreachable("Unsupported intrinsic!");
22378b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer    case X86::BI__builtin_ia32_pswapdsf:
22388b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer    case X86::BI__builtin_ia32_pswapdsi:
22398b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer      name = "pswapd";
22408b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer      ID = Intrinsic::x86_3dnowa_pswapd;
22418b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer      break;
22428b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer    }
22438b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer    llvm::Function *F = CGM.getIntrinsic(ID);
22444c7d9f1507d0f102bd4133bba63348636facd469Jay Foad    return Builder.CreateCall(F, Ops, name);
22458b36a9ee7fe7204b30a85b95b11850aeb4b63ee3Michael J. Spencer  }
2246564f1de67d7ba43646b8740db86d6269e3dfbe0bAnders Carlsson  }
2247564f1de67d7ba43646b8740db86d6269e3dfbe0bAnders Carlsson}
2248564f1de67d7ba43646b8740db86d6269e3dfbe0bAnders Carlsson
22499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony LinthicumValue *CodeGenFunction::EmitHexagonBuiltinExpr(unsigned BuiltinID,
22519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum                                             const CallExpr *E) {
22529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  llvm::SmallVector<Value*, 4> Ops;
22539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  for (unsigned i = 0, e = E->getNumArgs(); i != e; i++)
22559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    Ops.push_back(EmitScalarExpr(E->getArg(i)));
22569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  Intrinsic::ID ID = Intrinsic::not_intrinsic;
22589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  switch (BuiltinID) {
22609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  default: return 0;
22619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmpeq:
22639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmpeq; break;
22649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmpgt:
22669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmpgt; break;
22679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmpgtu:
22699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmpgtu; break;
22709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmpeqp:
22729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmpeqp; break;
22739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmpgtp:
22759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmpgtp; break;
22769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmpgtup:
22789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmpgtup; break;
22799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_bitsset:
22819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_bitsset; break;
22829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_bitsclr:
22849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_bitsclr; break;
22859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmpeqi:
22879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmpeqi; break;
22889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmpgti:
22909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmpgti; break;
22919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmpgtui:
22939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmpgtui; break;
22949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmpgei:
22969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmpgei; break;
22979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
22989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmpgeui:
22999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmpgeui; break;
23009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmplt:
23029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmplt; break;
23039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_cmpltu:
23059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_cmpltu; break;
23069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_bitsclri:
23089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_bitsclri; break;
23099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_and:
23119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_and; break;
23129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_or:
23149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_or; break;
23159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_xor:
23179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_xor; break;
23189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_andn:
23209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_andn; break;
23219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_not:
23239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_not; break;
23249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_orn:
23269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_orn; break;
23279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_pxfer_map:
23299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_pxfer_map; break;
23309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_any8:
23329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_any8; break;
23339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_all8:
23359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_all8; break;
23369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_vitpack:
23389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_vitpack; break;
23399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_mux:
23419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_mux; break;
23429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_muxii:
23449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_muxii; break;
23459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_muxir:
23479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_muxir; break;
23489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_muxri:
23509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_muxri; break;
23519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_vmux:
23539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_vmux; break;
23549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_mask:
23569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_mask; break;
23579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vcmpbeq:
23599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vcmpbeq; break;
23609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vcmpbgtu:
23629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vcmpbgtu; break;
23639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vcmpheq:
23659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vcmpheq; break;
23669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vcmphgt:
23689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vcmphgt; break;
23699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vcmphgtu:
23719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vcmphgtu; break;
23729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vcmpweq:
23749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vcmpweq; break;
23759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vcmpwgt:
23779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vcmpwgt; break;
23789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vcmpwgtu:
23809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vcmpwgtu; break;
23819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_tfrpr:
23839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_tfrpr; break;
23849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C2_tfrrp:
23869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C2_tfrrp; break;
23879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_hh_s0:
23899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_hh_s0; break;
23909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_hh_s1:
23929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_hh_s1; break;
23939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_hl_s0:
23959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_hl_s0; break;
23969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
23979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_hl_s1:
23989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_hl_s1; break;
23999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_lh_s0:
24019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_lh_s0; break;
24029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_lh_s1:
24049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_lh_s1; break;
24059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_ll_s0:
24079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_ll_s0; break;
24089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_ll_s1:
24109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_ll_s1; break;
24119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_hh_s0:
24139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_hh_s0; break;
24149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_hh_s1:
24169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_hh_s1; break;
24179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_hl_s0:
24199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_hl_s0; break;
24209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_hl_s1:
24229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_hl_s1; break;
24239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_lh_s0:
24259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_lh_s0; break;
24269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_lh_s1:
24289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_lh_s1; break;
24299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_ll_s0:
24319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_ll_s0; break;
24329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_ll_s1:
24349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_ll_s1; break;
24359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_sat_hh_s0:
24379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_sat_hh_s0; break;
24389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_sat_hh_s1:
24409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_sat_hh_s1; break;
24419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_sat_hl_s0:
24439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_sat_hl_s0; break;
24449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_sat_hl_s1:
24469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_sat_hl_s1; break;
24479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_sat_lh_s0:
24499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_sat_lh_s0; break;
24509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_sat_lh_s1:
24529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_sat_lh_s1; break;
24539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_sat_ll_s0:
24559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_sat_ll_s0; break;
24569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_acc_sat_ll_s1:
24589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_acc_sat_ll_s1; break;
24599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_sat_hh_s0:
24619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_sat_hh_s0; break;
24629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_sat_hh_s1:
24649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_sat_hh_s1; break;
24659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_sat_hl_s0:
24679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_sat_hl_s0; break;
24689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_sat_hl_s1:
24709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_sat_hl_s1; break;
24719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_sat_lh_s0:
24739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_sat_lh_s0; break;
24749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_sat_lh_s1:
24769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_sat_lh_s1; break;
24779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_sat_ll_s0:
24799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_sat_ll_s0; break;
24809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_nac_sat_ll_s1:
24829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_nac_sat_ll_s1; break;
24839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_hh_s0:
24859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_hh_s0; break;
24869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_hh_s1:
24889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_hh_s1; break;
24899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_hl_s0:
24919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_hl_s0; break;
24929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_hl_s1:
24949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_hl_s1; break;
24959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_lh_s0:
24979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_lh_s0; break;
24989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
24999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_lh_s1:
25009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_lh_s1; break;
25019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_ll_s0:
25039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_ll_s0; break;
25049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_ll_s1:
25069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_ll_s1; break;
25079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_hh_s0:
25099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_hh_s0; break;
25109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_hh_s1:
25129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_hh_s1; break;
25139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_hl_s0:
25159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_hl_s0; break;
25169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_hl_s1:
25189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_hl_s1; break;
25199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_lh_s0:
25219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_lh_s0; break;
25229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_lh_s1:
25249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_lh_s1; break;
25259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_ll_s0:
25279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_ll_s0; break;
25289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_ll_s1:
25309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_ll_s1; break;
25319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_rnd_hh_s0:
25339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_rnd_hh_s0; break;
25349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_rnd_hh_s1:
25369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_rnd_hh_s1; break;
25379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_rnd_hl_s0:
25399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_rnd_hl_s0; break;
25409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_rnd_hl_s1:
25429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_rnd_hl_s1; break;
25439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_rnd_lh_s0:
25459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_rnd_lh_s0; break;
25469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_rnd_lh_s1:
25489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_rnd_lh_s1; break;
25499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_rnd_ll_s0:
25519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_rnd_ll_s0; break;
25529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_rnd_ll_s1:
25549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_rnd_ll_s1; break;
25559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_rnd_hh_s0:
25579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_rnd_hh_s0; break;
25589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_rnd_hh_s1:
25609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_rnd_hh_s1; break;
25619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_rnd_hl_s0:
25639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_rnd_hl_s0; break;
25649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_rnd_hl_s1:
25669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_rnd_hl_s1; break;
25679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_rnd_lh_s0:
25699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_rnd_lh_s0; break;
25709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_rnd_lh_s1:
25729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_rnd_lh_s1; break;
25739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_rnd_ll_s0:
25759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_rnd_ll_s0; break;
25769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_sat_rnd_ll_s1:
25789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_sat_rnd_ll_s1; break;
25799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_acc_hh_s0:
25819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_acc_hh_s0; break;
25829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_acc_hh_s1:
25849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_acc_hh_s1; break;
25859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_acc_hl_s0:
25879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_acc_hl_s0; break;
25889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_acc_hl_s1:
25909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_acc_hl_s1; break;
25919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_acc_lh_s0:
25939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_acc_lh_s0; break;
25949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_acc_lh_s1:
25969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_acc_lh_s1; break;
25979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
25989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_acc_ll_s0:
25999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_acc_ll_s0; break;
26009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_acc_ll_s1:
26029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_acc_ll_s1; break;
26039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_nac_hh_s0:
26059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_nac_hh_s0; break;
26069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_nac_hh_s1:
26089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_nac_hh_s1; break;
26099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_nac_hl_s0:
26119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_nac_hl_s0; break;
26129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_nac_hl_s1:
26149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_nac_hl_s1; break;
26159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_nac_lh_s0:
26179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_nac_lh_s0; break;
26189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_nac_lh_s1:
26209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_nac_lh_s1; break;
26219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_nac_ll_s0:
26239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_nac_ll_s0; break;
26249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_nac_ll_s1:
26269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_nac_ll_s1; break;
26279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_hh_s0:
26299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_hh_s0; break;
26309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_hh_s1:
26329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_hh_s1; break;
26339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_hl_s0:
26359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_hl_s0; break;
26369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_hl_s1:
26389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_hl_s1; break;
26399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_lh_s0:
26419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_lh_s0; break;
26429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_lh_s1:
26449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_lh_s1; break;
26459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_ll_s0:
26479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_ll_s0; break;
26489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_ll_s1:
26509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_ll_s1; break;
26519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_rnd_hh_s0:
26539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_rnd_hh_s0; break;
26549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_rnd_hh_s1:
26569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_rnd_hh_s1; break;
26579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_rnd_hl_s0:
26599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_rnd_hl_s0; break;
26609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_rnd_hl_s1:
26629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_rnd_hl_s1; break;
26639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_rnd_lh_s0:
26659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_rnd_lh_s0; break;
26669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_rnd_lh_s1:
26689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_rnd_lh_s1; break;
26699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_rnd_ll_s0:
26719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_rnd_ll_s0; break;
26729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyd_rnd_ll_s1:
26749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyd_rnd_ll_s1; break;
26759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_acc_hh_s0:
26779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_acc_hh_s0; break;
26789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_acc_hh_s1:
26809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_acc_hh_s1; break;
26819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_acc_hl_s0:
26839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_acc_hl_s0; break;
26849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_acc_hl_s1:
26869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_acc_hl_s1; break;
26879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_acc_lh_s0:
26899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_acc_lh_s0; break;
26909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_acc_lh_s1:
26929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_acc_lh_s1; break;
26939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_acc_ll_s0:
26959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_acc_ll_s0; break;
26969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
26979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_acc_ll_s1:
26989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_acc_ll_s1; break;
26999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_nac_hh_s0:
27019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_nac_hh_s0; break;
27029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_nac_hh_s1:
27049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_nac_hh_s1; break;
27059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_nac_hl_s0:
27079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_nac_hl_s0; break;
27089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_nac_hl_s1:
27109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_nac_hl_s1; break;
27119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_nac_lh_s0:
27139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_nac_lh_s0; break;
27149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_nac_lh_s1:
27169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_nac_lh_s1; break;
27179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_nac_ll_s0:
27199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_nac_ll_s0; break;
27209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_nac_ll_s1:
27229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_nac_ll_s1; break;
27239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_hh_s0:
27259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_hh_s0; break;
27269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_hh_s1:
27289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_hh_s1; break;
27299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_hl_s0:
27319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_hl_s0; break;
27329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_hl_s1:
27349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_hl_s1; break;
27359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_lh_s0:
27379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_lh_s0; break;
27389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_lh_s1:
27409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_lh_s1; break;
27419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_ll_s0:
27439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_ll_s0; break;
27449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_ll_s1:
27469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_ll_s1; break;
27479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_acc_hh_s0:
27499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_acc_hh_s0; break;
27509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_acc_hh_s1:
27529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_acc_hh_s1; break;
27539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_acc_hl_s0:
27559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_acc_hl_s0; break;
27569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_acc_hl_s1:
27589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_acc_hl_s1; break;
27599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_acc_lh_s0:
27619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_acc_lh_s0; break;
27629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_acc_lh_s1:
27649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_acc_lh_s1; break;
27659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_acc_ll_s0:
27679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_acc_ll_s0; break;
27689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_acc_ll_s1:
27709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_acc_ll_s1; break;
27719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_nac_hh_s0:
27739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_nac_hh_s0; break;
27749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_nac_hh_s1:
27769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_nac_hh_s1; break;
27779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_nac_hl_s0:
27799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_nac_hl_s0; break;
27809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_nac_hl_s1:
27829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_nac_hl_s1; break;
27839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_nac_lh_s0:
27859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_nac_lh_s0; break;
27869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_nac_lh_s1:
27889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_nac_lh_s1; break;
27899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_nac_ll_s0:
27919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_nac_ll_s0; break;
27929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_nac_ll_s1:
27949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_nac_ll_s1; break;
27959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_hh_s0:
27979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_hh_s0; break;
27989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
27999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_hh_s1:
28009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_hh_s1; break;
28019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_hl_s0:
28039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_hl_s0; break;
28049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_hl_s1:
28069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_hl_s1; break;
28079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_lh_s0:
28099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_lh_s0; break;
28109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_lh_s1:
28129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_lh_s1; break;
28139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_ll_s0:
28159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_ll_s0; break;
28169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyud_ll_s1:
28189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyud_ll_s1; break;
28199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpysmi:
28219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpysmi; break;
28229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_macsip:
28249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_macsip; break;
28259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_macsin:
28279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_macsin; break;
28289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_dpmpyss_s0:
28309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_dpmpyss_s0; break;
28319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_dpmpyss_acc_s0:
28339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_dpmpyss_acc_s0; break;
28349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_dpmpyss_nac_s0:
28369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_dpmpyss_nac_s0; break;
28379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_dpmpyuu_s0:
28399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_dpmpyuu_s0; break;
28409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_dpmpyuu_acc_s0:
28429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_dpmpyuu_acc_s0; break;
28439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_dpmpyuu_nac_s0:
28459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_dpmpyuu_nac_s0; break;
28469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpy_up:
28489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpy_up; break;
28499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyu_up:
28519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyu_up; break;
28529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_dpmpyss_rnd_s0:
28549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_dpmpyss_rnd_s0; break;
28559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyi:
28579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyi; break;
28589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mpyui:
28609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mpyui; break;
28619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_maci:
28639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_maci; break;
28649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_acci:
28669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_acci; break;
28679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_accii:
28699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_accii; break;
28709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_nacci:
28729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_nacci; break;
28739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_naccii:
28759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_naccii; break;
28769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_subacc:
28789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_subacc; break;
28799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vmpy2s_s0:
28819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vmpy2s_s0; break;
28829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vmpy2s_s1:
28849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vmpy2s_s1; break;
28859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vmac2s_s0:
28879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vmac2s_s0; break;
28889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vmac2s_s1:
28909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vmac2s_s1; break;
28919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vmpy2s_s0pack:
28939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vmpy2s_s0pack; break;
28949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vmpy2s_s1pack:
28969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vmpy2s_s1pack; break;
28979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
28989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vmac2:
28999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vmac2; break;
29009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vmpy2es_s0:
29029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vmpy2es_s0; break;
29039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vmpy2es_s1:
29059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vmpy2es_s1; break;
29069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vmac2es_s0:
29089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vmac2es_s0; break;
29099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vmac2es_s1:
29119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vmac2es_s1; break;
29129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vmac2es:
29149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vmac2es; break;
29159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrmac_s0:
29179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrmac_s0; break;
29189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrmpy_s0:
29209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrmpy_s0; break;
29219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vdmpyrs_s0:
29239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vdmpyrs_s0; break;
29249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vdmpyrs_s1:
29269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vdmpyrs_s1; break;
29279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vdmacs_s0:
29299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vdmacs_s0; break;
29309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vdmacs_s1:
29329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vdmacs_s1; break;
29339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vdmpys_s0:
29359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vdmpys_s0; break;
29369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vdmpys_s1:
29389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vdmpys_s1; break;
29399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmpyrs_s0:
29419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmpyrs_s0; break;
29429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmpyrs_s1:
29449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmpyrs_s1; break;
29459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmpyrsc_s0:
29479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmpyrsc_s0; break;
29489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmpyrsc_s1:
29509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmpyrsc_s1; break;
29519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmacs_s0:
29539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmacs_s0; break;
29549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmacs_s1:
29569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmacs_s1; break;
29579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmacsc_s0:
29599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmacsc_s0; break;
29609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmacsc_s1:
29629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmacsc_s1; break;
29639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmpys_s0:
29659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmpys_s0; break;
29669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmpys_s1:
29689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmpys_s1; break;
29699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmpysc_s0:
29719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmpysc_s0; break;
29729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmpysc_s1:
29749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmpysc_s1; break;
29759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cnacs_s0:
29779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cnacs_s0; break;
29789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cnacs_s1:
29809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cnacs_s1; break;
29819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cnacsc_s0:
29839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cnacsc_s0; break;
29849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cnacsc_s1:
29869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cnacsc_s1; break;
29879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrcmpys_s1:
29899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrcmpys_s1; break;
29909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrcmpys_acc_s1:
29929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrcmpys_acc_s1; break;
29939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrcmpys_s1rp:
29959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrcmpys_s1rp; break;
29969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
29979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmacls_s0:
29989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmacls_s0; break;
29999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmacls_s1:
30019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmacls_s1; break;
30029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmachs_s0:
30049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmachs_s0; break;
30059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmachs_s1:
30079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmachs_s1; break;
30089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyl_s0:
30109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyl_s0; break;
30119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyl_s1:
30139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyl_s1; break;
30149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyh_s0:
30169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyh_s0; break;
30179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyh_s1:
30199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyh_s1; break;
30209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmacls_rs0:
30229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmacls_rs0; break;
30239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmacls_rs1:
30259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmacls_rs1; break;
30269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmachs_rs0:
30289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmachs_rs0; break;
30299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmachs_rs1:
30319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmachs_rs1; break;
30329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyl_rs0:
30349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyl_rs0; break;
30359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyl_rs1:
30379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyl_rs1; break;
30389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyh_rs0:
30409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyh_rs0; break;
30419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyh_rs1:
30439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyh_rs1; break;
30449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_hmmpyl_rs1:
30469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_hmmpyl_rs1; break;
30479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_hmmpyh_rs1:
30499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_hmmpyh_rs1; break;
30509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmaculs_s0:
30529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmaculs_s0; break;
30539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmaculs_s1:
30559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmaculs_s1; break;
30569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmacuhs_s0:
30589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmacuhs_s0; break;
30599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmacuhs_s1:
30619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmacuhs_s1; break;
30629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyul_s0:
30649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyul_s0; break;
30659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyul_s1:
30679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyul_s1; break;
30689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyuh_s0:
30709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyuh_s0; break;
30719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyuh_s1:
30739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyuh_s1; break;
30749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmaculs_rs0:
30769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmaculs_rs0; break;
30779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmaculs_rs1:
30799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmaculs_rs1; break;
30809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmacuhs_rs0:
30829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmacuhs_rs0; break;
30839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmacuhs_rs1:
30859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmacuhs_rs1; break;
30869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyul_rs0:
30889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyul_rs0; break;
30899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyul_rs1:
30919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyul_rs1; break;
30929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyuh_rs0:
30949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyuh_rs0; break;
30959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_mmpyuh_rs1:
30979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_mmpyuh_rs1; break;
30989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
30999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrcmaci_s0:
31009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrcmaci_s0; break;
31019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrcmacr_s0:
31039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrcmacr_s0; break;
31049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrcmaci_s0c:
31069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrcmaci_s0c; break;
31079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrcmacr_s0c:
31099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrcmacr_s0c; break;
31109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmaci_s0:
31129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmaci_s0; break;
31139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmacr_s0:
31159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmacr_s0; break;
31169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrcmpyi_s0:
31189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrcmpyi_s0; break;
31199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrcmpyr_s0:
31219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrcmpyr_s0; break;
31229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrcmpyi_s0c:
31249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrcmpyi_s0c; break;
31259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vrcmpyr_s0c:
31279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vrcmpyr_s0c; break;
31289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmpyi_s0:
31309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmpyi_s0; break;
31319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_cmpyr_s0:
31339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_cmpyr_s0; break;
31349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vcmpy_s0_sat_i:
31369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vcmpy_s0_sat_i; break;
31379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vcmpy_s0_sat_r:
31399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vcmpy_s0_sat_r; break;
31409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vcmpy_s1_sat_i:
31429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vcmpy_s1_sat_i; break;
31439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vcmpy_s1_sat_r:
31459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vcmpy_s1_sat_r; break;
31469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vcmac_s0_sat_i:
31489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vcmac_s0_sat_i; break;
31499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vcmac_s0_sat_r:
31519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vcmac_s0_sat_r; break;
31529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vcrotate:
31549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vcrotate; break;
31559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_add:
31579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_add; break;
31589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_sub:
31609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_sub; break;
31619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addsat:
31639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addsat; break;
31649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subsat:
31669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subsat; break;
31679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addi:
31699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addi; break;
31709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addh_l16_ll:
31729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addh_l16_ll; break;
31739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addh_l16_hl:
31759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addh_l16_hl; break;
31769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addh_l16_sat_ll:
31789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addh_l16_sat_ll; break;
31799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addh_l16_sat_hl:
31819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addh_l16_sat_hl; break;
31829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subh_l16_ll:
31849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subh_l16_ll; break;
31859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subh_l16_hl:
31879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subh_l16_hl; break;
31889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subh_l16_sat_ll:
31909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subh_l16_sat_ll; break;
31919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subh_l16_sat_hl:
31939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subh_l16_sat_hl; break;
31949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addh_h16_ll:
31969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addh_h16_ll; break;
31979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
31989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addh_h16_lh:
31999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addh_h16_lh; break;
32009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addh_h16_hl:
32029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addh_h16_hl; break;
32039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addh_h16_hh:
32059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addh_h16_hh; break;
32069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addh_h16_sat_ll:
32089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addh_h16_sat_ll; break;
32099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addh_h16_sat_lh:
32119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addh_h16_sat_lh; break;
32129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addh_h16_sat_hl:
32149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addh_h16_sat_hl; break;
32159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addh_h16_sat_hh:
32179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addh_h16_sat_hh; break;
32189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subh_h16_ll:
32209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subh_h16_ll; break;
32219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subh_h16_lh:
32239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subh_h16_lh; break;
32249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subh_h16_hl:
32269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subh_h16_hl; break;
32279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subh_h16_hh:
32299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subh_h16_hh; break;
32309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subh_h16_sat_ll:
32329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subh_h16_sat_ll; break;
32339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subh_h16_sat_lh:
32359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subh_h16_sat_lh; break;
32369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subh_h16_sat_hl:
32389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subh_h16_sat_hl; break;
32399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subh_h16_sat_hh:
32419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subh_h16_sat_hh; break;
32429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_aslh:
32449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_aslh; break;
32459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_asrh:
32479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_asrh; break;
32489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addp:
32509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addp; break;
32519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addpsat:
32539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addpsat; break;
32549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_addsp:
32569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_addsp; break;
32579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subp:
32599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subp; break;
32609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_neg:
32629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_neg; break;
32639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_negsat:
32659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_negsat; break;
32669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_abs:
32689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_abs; break;
32699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_abssat:
32719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_abssat; break;
32729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vconj:
32749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vconj; break;
32759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_negp:
32779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_negp; break;
32789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_absp:
32809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_absp; break;
32819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_max:
32839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_max; break;
32849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_maxu:
32869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_maxu; break;
32879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_min:
32899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_min; break;
32909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_minu:
32929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_minu; break;
32939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_maxp:
32959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_maxp; break;
32969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
32979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_maxup:
32989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_maxup; break;
32999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_minp:
33019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_minp; break;
33029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_minup:
33049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_minup; break;
33059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_tfr:
33079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_tfr; break;
33089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_tfrsi:
33109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_tfrsi; break;
33119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_tfrp:
33139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_tfrp; break;
33149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_tfrpi:
33169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_tfrpi; break;
33179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_zxtb:
33199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_zxtb; break;
33209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_sxtb:
33229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_sxtb; break;
33239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_zxth:
33259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_zxth; break;
33269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_sxth:
33289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_sxth; break;
33299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_combinew:
33319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_combinew; break;
33329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_combineii:
33349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_combineii; break;
33359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_combine_hh:
33379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_combine_hh; break;
33389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_combine_hl:
33409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_combine_hl; break;
33419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_combine_lh:
33439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_combine_lh; break;
33449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_combine_ll:
33469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_combine_ll; break;
33479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_tfril:
33499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_tfril; break;
33509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_tfrih:
33529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_tfrih; break;
33539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_and:
33559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_and; break;
33569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_or:
33589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_or; break;
33599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_xor:
33619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_xor; break;
33629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_not:
33649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_not; break;
33659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_xor_xacc:
33679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_xor_xacc; break;
33689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_subri:
33709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_subri; break;
33719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_andir:
33739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_andir; break;
33749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_orir:
33769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_orir; break;
33779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_andp:
33799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_andp; break;
33809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_orp:
33829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_orp; break;
33839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_xorp:
33859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_xorp; break;
33869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_notp:
33889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_notp; break;
33899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_sxtw:
33919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_sxtw; break;
33929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_sat:
33949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_sat; break;
33959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_sath:
33979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_sath; break;
33989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
33999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_satuh:
34009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_satuh; break;
34019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_satub:
34039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_satub; break;
34049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_satb:
34069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_satb; break;
34079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vaddub:
34099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vaddub; break;
34109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vaddubs:
34129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vaddubs; break;
34139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vaddh:
34159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vaddh; break;
34169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vaddhs:
34189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vaddhs; break;
34199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vadduhs:
34219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vadduhs; break;
34229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vaddw:
34249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vaddw; break;
34259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vaddws:
34279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vaddws; break;
34289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_svavgh:
34309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_svavgh; break;
34319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_svavghs:
34339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_svavghs; break;
34349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_svnavgh:
34369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_svnavgh; break;
34379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_svaddh:
34399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_svaddh; break;
34409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_svaddhs:
34429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_svaddhs; break;
34439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_svadduhs:
34459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_svadduhs; break;
34469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_svsubh:
34489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_svsubh; break;
34499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_svsubhs:
34519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_svsubhs; break;
34529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_svsubuhs:
34549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_svsubuhs; break;
34559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vraddub:
34579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vraddub; break;
34589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vraddub_acc:
34609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vraddub_acc; break;
34619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vradduh:
34639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vradduh; break;
34649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vsubub:
34669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vsubub; break;
34679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vsububs:
34699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vsububs; break;
34709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vsubh:
34729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vsubh; break;
34739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vsubhs:
34759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vsubhs; break;
34769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vsubuhs:
34789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vsubuhs; break;
34799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vsubw:
34819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vsubw; break;
34829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vsubws:
34849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vsubws; break;
34859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vabsh:
34879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vabsh; break;
34889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vabshsat:
34909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vabshsat; break;
34919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vabsw:
34939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vabsw; break;
34949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vabswsat:
34969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vabswsat; break;
34979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
34989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vabsdiffw:
34999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vabsdiffw; break;
35009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M2_vabsdiffh:
35029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M2_vabsdiffh; break;
35039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vrsadub:
35059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vrsadub; break;
35069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vrsadub_acc:
35089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vrsadub_acc; break;
35099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vavgub:
35119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vavgub; break;
35129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vavguh:
35149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vavguh; break;
35159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vavgh:
35179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vavgh; break;
35189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vnavgh:
35209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vnavgh; break;
35219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vavgw:
35239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vavgw; break;
35249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vnavgw:
35269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vnavgw; break;
35279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vavgwr:
35299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vavgwr; break;
35309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vnavgwr:
35329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vnavgwr; break;
35339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vavgwcr:
35359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vavgwcr; break;
35369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vnavgwcr:
35389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vnavgwcr; break;
35399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vavghcr:
35419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vavghcr; break;
35429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vnavghcr:
35449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vnavghcr; break;
35459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vavguw:
35479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vavguw; break;
35489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vavguwr:
35509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vavguwr; break;
35519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vavgubr:
35539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vavgubr; break;
35549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vavguhr:
35569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vavguhr; break;
35579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vavghr:
35599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vavghr; break;
35609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vnavghr:
35629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vnavghr; break;
35639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vminh:
35659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vminh; break;
35669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vmaxh:
35689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vmaxh; break;
35699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vminub:
35719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vminub; break;
35729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vmaxub:
35749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vmaxub; break;
35759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vminuh:
35779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vminuh; break;
35789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vmaxuh:
35809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vmaxuh; break;
35819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vminw:
35839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vminw; break;
35849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vmaxw:
35869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vmaxw; break;
35879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vminuw:
35899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vminuw; break;
35909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_vmaxuw:
35929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_vmaxuw; break;
35939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_r:
35959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_r; break;
35969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
35979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_r:
35989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_r; break;
35999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_r_r:
36019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_r_r; break;
36029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsl_r_r:
36049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsl_r_r; break;
36059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_p:
36079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_p; break;
36089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_p:
36109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_p; break;
36119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_r_p:
36139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_r_p; break;
36149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsl_r_p:
36169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsl_r_p; break;
36179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_r_acc:
36199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_r_acc; break;
36209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_r_acc:
36229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_r_acc; break;
36239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_r_r_acc:
36259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_r_r_acc; break;
36269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsl_r_r_acc:
36289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsl_r_r_acc; break;
36299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_p_acc:
36319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_p_acc; break;
36329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_p_acc:
36349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_p_acc; break;
36359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_r_p_acc:
36379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_r_p_acc; break;
36389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsl_r_p_acc:
36409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsl_r_p_acc; break;
36419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_r_nac:
36439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_r_nac; break;
36449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_r_nac:
36469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_r_nac; break;
36479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_r_r_nac:
36499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_r_r_nac; break;
36509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsl_r_r_nac:
36529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsl_r_r_nac; break;
36539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_p_nac:
36559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_p_nac; break;
36569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_p_nac:
36589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_p_nac; break;
36599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_r_p_nac:
36619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_r_p_nac; break;
36629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsl_r_p_nac:
36649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsl_r_p_nac; break;
36659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_r_and:
36679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_r_and; break;
36689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_r_and:
36709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_r_and; break;
36719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_r_r_and:
36739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_r_r_and; break;
36749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsl_r_r_and:
36769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsl_r_r_and; break;
36779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_r_or:
36799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_r_or; break;
36809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_r_or:
36829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_r_or; break;
36839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_r_r_or:
36859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_r_r_or; break;
36869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsl_r_r_or:
36889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsl_r_r_or; break;
36899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_p_and:
36919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_p_and; break;
36929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_p_and:
36949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_p_and; break;
36959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_r_p_and:
36979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_r_p_and; break;
36989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
36999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsl_r_p_and:
37009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsl_r_p_and; break;
37019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_p_or:
37039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_p_or; break;
37049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_p_or:
37069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_p_or; break;
37079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_r_p_or:
37099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_r_p_or; break;
37109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsl_r_p_or:
37129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsl_r_p_or; break;
37139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_r_sat:
37159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_r_sat; break;
37169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_r_sat:
37189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_r_sat; break;
37199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_r:
37219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_r; break;
37229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_r:
37249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_r; break;
37259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_r:
37279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_r; break;
37289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_p:
37309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_p; break;
37319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_p:
37339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_p; break;
37349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_p:
37369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_p; break;
37379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_r_acc:
37399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_r_acc; break;
37409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_r_acc:
37429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_r_acc; break;
37439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_r_acc:
37459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_r_acc; break;
37469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_p_acc:
37489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_p_acc; break;
37499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_p_acc:
37519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_p_acc; break;
37529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_p_acc:
37549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_p_acc; break;
37559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_r_nac:
37579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_r_nac; break;
37589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_r_nac:
37609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_r_nac; break;
37619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_r_nac:
37639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_r_nac; break;
37649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_p_nac:
37669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_p_nac; break;
37679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_p_nac:
37699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_p_nac; break;
37709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_p_nac:
37729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_p_nac; break;
37739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_r_xacc:
37759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_r_xacc; break;
37769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_r_xacc:
37789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_r_xacc; break;
37799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_p_xacc:
37819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_p_xacc; break;
37829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_p_xacc:
37849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_p_xacc; break;
37859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_r_and:
37879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_r_and; break;
37889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_r_and:
37909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_r_and; break;
37919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_r_and:
37939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_r_and; break;
37949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_r_or:
37969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_r_or; break;
37979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
37989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_r_or:
37999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_r_or; break;
38009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_r_or:
38029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_r_or; break;
38039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_p_and:
38059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_p_and; break;
38069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_p_and:
38089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_p_and; break;
38099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_p_and:
38119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_p_and; break;
38129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_p_or:
38149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_p_or; break;
38159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_p_or:
38179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_p_or; break;
38189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_p_or:
38209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_p_or; break;
38219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_r_sat:
38239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_r_sat; break;
38249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_r_rnd:
38269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_r_rnd; break;
38279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_r_rnd_goodsyntax:
38299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_r_rnd_goodsyntax; break;
38309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_addasl_rrri:
38329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_addasl_rrri; break;
38339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_valignib:
38359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_valignib; break;
38369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_valignrb:
38389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_valignrb; break;
38399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vspliceib:
38419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vspliceib; break;
38429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsplicerb:
38449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsplicerb; break;
38459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsplatrh:
38479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsplatrh; break;
38489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsplatrb:
38509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsplatrb; break;
38519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_insert:
38539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_insert; break;
38549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_tableidxb_goodsyntax:
38569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_tableidxb_goodsyntax; break;
38579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_tableidxh_goodsyntax:
38599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_tableidxh_goodsyntax; break;
38609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_tableidxw_goodsyntax:
38629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_tableidxw_goodsyntax; break;
38639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_tableidxd_goodsyntax:
38659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_tableidxd_goodsyntax; break;
38669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_extractu:
38689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_extractu; break;
38699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_insertp:
38719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_insertp; break;
38729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_extractup:
38749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_extractup; break;
38759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_insert_rp:
38779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_insert_rp; break;
38789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_extractu_rp:
38809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_extractu_rp; break;
38819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_insertp_rp:
38839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_insertp_rp; break;
38849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_extractup_rp:
38869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_extractup_rp; break;
38879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_tstbit_i:
38899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_tstbit_i; break;
38909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_setbit_i:
38929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_setbit_i; break;
38939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_togglebit_i:
38959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_togglebit_i; break;
38969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
38979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_clrbit_i:
38989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_clrbit_i; break;
38999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_tstbit_r:
39019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_tstbit_r; break;
39029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_setbit_r:
39049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_setbit_r; break;
39059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_togglebit_r:
39079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_togglebit_r; break;
39089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_clrbit_r:
39109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_clrbit_r; break;
39119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_vh:
39139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_vh; break;
39149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_vh:
39169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_vh; break;
39179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_vh:
39199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_vh; break;
39209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_vh:
39229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_vh; break;
39239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_vh:
39259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_vh; break;
39269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_r_vh:
39289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_r_vh; break;
39299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsl_r_vh:
39319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsl_r_vh; break;
39329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_vw:
39349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_vw; break;
39359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_i_svw_trun:
39379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_i_svw_trun; break;
39389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_svw_trun:
39409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_svw_trun; break;
39419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_i_vw:
39439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_i_vw; break;
39449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_i_vw:
39469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_i_vw; break;
39479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asr_r_vw:
39499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asr_r_vw; break;
39509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_asl_r_vw:
39529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_asl_r_vw; break;
39539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsr_r_vw:
39559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsr_r_vw; break;
39569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lsl_r_vw:
39589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lsl_r_vw; break;
39599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vrndpackwh:
39619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vrndpackwh; break;
39629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vrndpackwhs:
39649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vrndpackwhs; break;
39659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsxtbh:
39679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsxtbh; break;
39689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vzxtbh:
39709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vzxtbh; break;
39719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsathub:
39739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsathub; break;
39749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_svsathub:
39769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_svsathub; break;
39779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_svsathb:
39799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_svsathb; break;
39809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsathb:
39829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsathb; break;
39839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vtrunohb:
39859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vtrunohb; break;
39869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vtrunewh:
39889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vtrunewh; break;
39899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vtrunowh:
39919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vtrunowh; break;
39929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vtrunehb:
39949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vtrunehb; break;
39959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsxthw:
39979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsxthw; break;
39989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
39999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vzxthw:
40009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vzxthw; break;
40019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsatwh:
40039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsatwh; break;
40049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsatwuh:
40069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsatwuh; break;
40079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_packhl:
40099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_packhl; break;
40109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A2_swiz:
40129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A2_swiz; break;
40139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsathub_nopack:
40159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsathub_nopack; break;
40169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsathb_nopack:
40189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsathb_nopack; break;
40199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsatwh_nopack:
40219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsatwh_nopack; break;
40229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_vsatwuh_nopack:
40249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_vsatwuh_nopack; break;
40259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_shuffob:
40279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_shuffob; break;
40289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_shuffeb:
40309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_shuffeb; break;
40319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_shuffoh:
40339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_shuffoh; break;
40349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_shuffeh:
40369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_shuffeh; break;
40379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_parityp:
40399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_parityp; break;
40409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_lfsp:
40429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_lfsp; break;
40439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_clbnorm:
40459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_clbnorm; break;
40469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_clb:
40489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_clb; break;
40499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_cl0:
40519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_cl0; break;
40529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_cl1:
40549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_cl1; break;
40559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_clbp:
40579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_clbp; break;
40589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_cl0p:
40609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_cl0p; break;
40619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_cl1p:
40639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_cl1p; break;
40649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_brev:
40669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_brev; break;
40679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_ct0:
40699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_ct0; break;
40709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_ct1:
40729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_ct1; break;
40739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_interleave:
40759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_interleave; break;
40769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S2_deinterleave:
40789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S2_deinterleave; break;
40799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_SI_to_SXTHI_asrh:
40819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_SI_to_SXTHI_asrh; break;
40829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_orn:
40849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_orn; break;
40859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_andn:
40879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_andn; break;
40889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_ornp:
40909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_ornp; break;
40919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_andnp:
40939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_andnp; break;
40949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_combineir:
40969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_combineir; break;
40979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
40989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_combineri:
40999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_combineri; break;
41009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_cmpneqi:
41029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_cmpneqi; break;
41039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_cmpneq:
41059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_cmpneq; break;
41069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_cmpltei:
41089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_cmpltei; break;
41099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_cmplte:
41119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_cmplte; break;
41129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_cmplteui:
41149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_cmplteui; break;
41159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_cmplteu:
41179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_cmplteu; break;
41189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_rcmpneq:
41209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_rcmpneq; break;
41219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_rcmpneqi:
41239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_rcmpneqi; break;
41249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_rcmpeq:
41269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_rcmpeq; break;
41279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_rcmpeqi:
41299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_rcmpeqi; break;
41309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_fastcorner9:
41329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_fastcorner9; break;
41339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_fastcorner9_not:
41359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_fastcorner9_not; break;
41369631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41379631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_and_andn:
41389631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_and_andn; break;
41399631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41409631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_and_and:
41419631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_and_and; break;
41429631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41439631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_and_orn:
41449631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_and_orn; break;
41459631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41469631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_and_or:
41479631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_and_or; break;
41489631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41499631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_or_andn:
41509631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_or_andn; break;
41519631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41529631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_or_and:
41539631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_or_and; break;
41549631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41559631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_or_orn:
41569631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_or_orn; break;
41579631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41589631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_C4_or_or:
41599631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_C4_or_or; break;
41609631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41619631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S4_addaddi:
41629631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S4_addaddi; break;
41639631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41649631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S4_subaddi:
41659631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S4_subaddi; break;
41669631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41679631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M4_xor_xacc:
41689631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M4_xor_xacc; break;
41699631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41709631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M4_and_and:
41719631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M4_and_and; break;
41729631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41739631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M4_and_or:
41749631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M4_and_or; break;
41759631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41769631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M4_and_xor:
41779631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M4_and_xor; break;
41789631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41799631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M4_and_andn:
41809631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M4_and_andn; break;
41819631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41829631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M4_xor_and:
41839631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M4_xor_and; break;
41849631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41859631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M4_xor_or:
41869631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M4_xor_or; break;
41879631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41889631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M4_xor_andn:
41899631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M4_xor_andn; break;
41909631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41919631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M4_or_and:
41929631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M4_or_and; break;
41939631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41949631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M4_or_or:
41959631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M4_or_or; break;
41969631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
41979631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M4_or_xor:
41989631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M4_or_xor; break;
41999631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42009631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_M4_or_andn:
42019631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_M4_or_andn; break;
42029631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42039631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S4_or_andix:
42049631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S4_or_andix; break;
42059631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42069631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S4_or_andi:
42079631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S4_or_andi; break;
42089631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42099631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_S4_or_ori:
42109631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_S4_or_ori; break;
42119631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42129631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_modwrapu:
42139631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_modwrapu; break;
42149631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42159631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_cround_rr:
42169631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_cround_rr; break;
42179631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42189631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_round_ri:
42199631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_round_ri; break;
42209631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42219631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_round_rr:
42229631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_round_rr; break;
42239631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42249631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_round_ri_sat:
42259631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_round_ri_sat; break;
42269631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42279631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  case Hexagon::BI__builtin_HEXAGON_A4_round_rr_sat:
42289631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum    ID = Intrinsic::hexagon_A4_round_rr_sat; break;
42299631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42309631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  }
42319631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42329631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  llvm::Function *F = CGM.getIntrinsic(ID);
42339631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum  return Builder.CreateCall(F, Ops, "");
42349631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum}
42359631939f82c0eaa6fb3936a0ce58a41adfbc9011Tony Linthicum
42361eb4433ac451dc16f4133a88af2d002ac26c58efMike StumpValue *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
42371feedd84221e8dbcc3faf3de27cc42b559db845dChris Lattner                                           const CallExpr *E) {
42385f9e272e632e951b1efe824cd16acb4d96077930Chris Lattner  SmallVector<Value*, 4> Ops;
4239dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner
4240dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  for (unsigned i = 0, e = E->getNumArgs(); i != e; i++)
4241dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner    Ops.push_back(EmitScalarExpr(E->getArg(i)));
4242dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner
4243dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  Intrinsic::ID ID = Intrinsic::not_intrinsic;
4244dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner
4245dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  switch (BuiltinID) {
4246dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  default: return 0;
4247dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner
42484d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov  // vec_ld, vec_lvsl, vec_lvsr
42494d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov  case PPC::BI__builtin_altivec_lvx:
42504d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov  case PPC::BI__builtin_altivec_lvxl:
42514d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov  case PPC::BI__builtin_altivec_lvebx:
42524d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov  case PPC::BI__builtin_altivec_lvehx:
42534d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov  case PPC::BI__builtin_altivec_lvewx:
42544d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov  case PPC::BI__builtin_altivec_lvsl:
42554d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov  case PPC::BI__builtin_altivec_lvsr:
42564d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov  {
4257d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    Ops[1] = Builder.CreateBitCast(Ops[1], Int8PtrTy);
42584d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov
4259578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    Ops[0] = Builder.CreateGEP(Ops[1], Ops[0]);
42604d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov    Ops.pop_back();
42614d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov
42624d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov    switch (BuiltinID) {
4263b219cfc4d75f0a03630b7c4509ef791b7e97b2c8David Blaikie    default: llvm_unreachable("Unsupported ld/lvsl/lvsr intrinsic!");
42644d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov    case PPC::BI__builtin_altivec_lvx:
42654d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      ID = Intrinsic::ppc_altivec_lvx;
42664d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      break;
42674d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov    case PPC::BI__builtin_altivec_lvxl:
42684d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      ID = Intrinsic::ppc_altivec_lvxl;
42694d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      break;
42704d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov    case PPC::BI__builtin_altivec_lvebx:
42714d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      ID = Intrinsic::ppc_altivec_lvebx;
42724d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      break;
42734d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov    case PPC::BI__builtin_altivec_lvehx:
42744d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      ID = Intrinsic::ppc_altivec_lvehx;
42754d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      break;
42764d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov    case PPC::BI__builtin_altivec_lvewx:
42774d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      ID = Intrinsic::ppc_altivec_lvewx;
42784d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      break;
42794d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov    case PPC::BI__builtin_altivec_lvsl:
42804d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      ID = Intrinsic::ppc_altivec_lvsl;
42814d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      break;
42824d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov    case PPC::BI__builtin_altivec_lvsr:
42834d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      ID = Intrinsic::ppc_altivec_lvsr;
42844d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov      break;
42854d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov    }
42864d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov    llvm::Function *F = CGM.getIntrinsic(ID);
42874c7d9f1507d0f102bd4133bba63348636facd469Jay Foad    return Builder.CreateCall(F, Ops, "");
42884d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov  }
42894d3a7b0a0608febe3cdac68f6121546672ca875eAnton Korobeynikov
4290dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  // vec_st
4291dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  case PPC::BI__builtin_altivec_stvx:
4292dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  case PPC::BI__builtin_altivec_stvxl:
4293dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  case PPC::BI__builtin_altivec_stvebx:
4294dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  case PPC::BI__builtin_altivec_stvehx:
4295dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  case PPC::BI__builtin_altivec_stvewx:
4296dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  {
4297d16c2cf1cafa413709aa487cbbd5dc392f1ba1ffJohn McCall    Ops[2] = Builder.CreateBitCast(Ops[2], Int8PtrTy);
4298578faa837b552403e2002b97fdfbfde14f2448e5Benjamin Kramer    Ops[1] = Builder.CreateGEP(Ops[2], Ops[1]);
4299dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner    Ops.pop_back();
4300dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner
4301dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner    switch (BuiltinID) {
4302b219cfc4d75f0a03630b7c4509ef791b7e97b2c8David Blaikie    default: llvm_unreachable("Unsupported st intrinsic!");
4303dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner    case PPC::BI__builtin_altivec_stvx:
4304dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner      ID = Intrinsic::ppc_altivec_stvx;
4305dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner      break;
4306dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner    case PPC::BI__builtin_altivec_stvxl:
4307dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner      ID = Intrinsic::ppc_altivec_stvxl;
4308dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner      break;
4309dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner    case PPC::BI__builtin_altivec_stvebx:
4310dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner      ID = Intrinsic::ppc_altivec_stvebx;
4311dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner      break;
4312dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner    case PPC::BI__builtin_altivec_stvehx:
4313dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner      ID = Intrinsic::ppc_altivec_stvehx;
4314dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner      break;
4315dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner    case PPC::BI__builtin_altivec_stvewx:
4316dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner      ID = Intrinsic::ppc_altivec_stvewx;
4317dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner      break;
4318dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner    }
4319dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner    llvm::Function *F = CGM.getIntrinsic(ID);
43204c7d9f1507d0f102bd4133bba63348636facd469Jay Foad    return Builder.CreateCall(F, Ops, "");
4321dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  }
4322dd17394d225b06376e9ae1d23f36cec463fdef01Chris Lattner  }
43231eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump}
4324