1//===- SemaChecking.cpp - Extra Semantic Checking -------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements extra semantic analysis beyond what is enforced
10// by the C type system.
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/AST/APValue.h"
15#include "clang/AST/ASTContext.h"
16#include "clang/AST/Attr.h"
17#include "clang/AST/AttrIterator.h"
18#include "clang/AST/CharUnits.h"
19#include "clang/AST/Decl.h"
20#include "clang/AST/DeclBase.h"
21#include "clang/AST/DeclCXX.h"
22#include "clang/AST/DeclObjC.h"
23#include "clang/AST/DeclarationName.h"
24#include "clang/AST/EvaluatedExprVisitor.h"
25#include "clang/AST/Expr.h"
26#include "clang/AST/ExprCXX.h"
27#include "clang/AST/ExprObjC.h"
28#include "clang/AST/ExprOpenMP.h"
29#include "clang/AST/FormatString.h"
30#include "clang/AST/NSAPI.h"
31#include "clang/AST/NonTrivialTypeVisitor.h"
32#include "clang/AST/OperationKinds.h"
33#include "clang/AST/Stmt.h"
34#include "clang/AST/TemplateBase.h"
35#include "clang/AST/Type.h"
36#include "clang/AST/TypeLoc.h"
37#include "clang/AST/UnresolvedSet.h"
38#include "clang/Basic/AddressSpaces.h"
39#include "clang/Basic/CharInfo.h"
40#include "clang/Basic/Diagnostic.h"
41#include "clang/Basic/IdentifierTable.h"
42#include "clang/Basic/LLVM.h"
43#include "clang/Basic/LangOptions.h"
44#include "clang/Basic/OpenCLOptions.h"
45#include "clang/Basic/OperatorKinds.h"
46#include "clang/Basic/PartialDiagnostic.h"
47#include "clang/Basic/SourceLocation.h"
48#include "clang/Basic/SourceManager.h"
49#include "clang/Basic/Specifiers.h"
50#include "clang/Basic/SyncScope.h"
51#include "clang/Basic/TargetBuiltins.h"
52#include "clang/Basic/TargetCXXABI.h"
53#include "clang/Basic/TargetInfo.h"
54#include "clang/Basic/TypeTraits.h"
55#include "clang/Lex/Lexer.h" // TODO: Extract static functions to fix layering.
56#include "clang/Sema/Initialization.h"
57#include "clang/Sema/Lookup.h"
58#include "clang/Sema/Ownership.h"
59#include "clang/Sema/Scope.h"
60#include "clang/Sema/ScopeInfo.h"
61#include "clang/Sema/Sema.h"
62#include "clang/Sema/SemaInternal.h"
63#include "llvm/ADT/APFloat.h"
64#include "llvm/ADT/APInt.h"
65#include "llvm/ADT/APSInt.h"
66#include "llvm/ADT/ArrayRef.h"
67#include "llvm/ADT/DenseMap.h"
68#include "llvm/ADT/FoldingSet.h"
69#include "llvm/ADT/None.h"
70#include "llvm/ADT/Optional.h"
71#include "llvm/ADT/STLExtras.h"
72#include "llvm/ADT/SmallBitVector.h"
73#include "llvm/ADT/SmallPtrSet.h"
74#include "llvm/ADT/SmallString.h"
75#include "llvm/ADT/SmallVector.h"
76#include "llvm/ADT/StringRef.h"
77#include "llvm/ADT/StringSwitch.h"
78#include "llvm/ADT/Triple.h"
79#include "llvm/Support/AtomicOrdering.h"
80#include "llvm/Support/Casting.h"
81#include "llvm/Support/Compiler.h"
82#include "llvm/Support/ConvertUTF.h"
83#include "llvm/Support/ErrorHandling.h"
84#include "llvm/Support/Format.h"
85#include "llvm/Support/Locale.h"
86#include "llvm/Support/MathExtras.h"
87#include "llvm/Support/raw_ostream.h"
88#include <algorithm>
89#include <cassert>
90#include <cstddef>
91#include <cstdint>
92#include <functional>
93#include <limits>
94#include <string>
95#include <tuple>
96#include <utility>
97
98using namespace clang;
99using namespace sema;
100
101SourceLocation Sema::getLocationOfStringLiteralByte(const StringLiteral *SL,
102 unsigned ByteNo) const {
103 return SL->getLocationOfByte(ByteNo, getSourceManager(), LangOpts,
104 Context.getTargetInfo());
105}
106
107/// Checks that a call expression's argument count is the desired number.
108/// This is useful when doing custom type-checking. Returns true on error.
109static bool checkArgCount(Sema &S, CallExpr *call, unsigned desiredArgCount) {
110 unsigned argCount = call->getNumArgs();
111 if (argCount == desiredArgCount) return false;
112
113 if (argCount < desiredArgCount)
114 return S.Diag(call->getEndLoc(), diag::err_typecheck_call_too_few_args)
115 << 0 /*function call*/ << desiredArgCount << argCount
116 << call->getSourceRange();
117
118 // Highlight all the excess arguments.
119 SourceRange range(call->getArg(desiredArgCount)->getBeginLoc(),
120 call->getArg(argCount - 1)->getEndLoc());
121
122 return S.Diag(range.getBegin(), diag::err_typecheck_call_too_many_args)
123 << 0 /*function call*/ << desiredArgCount << argCount
124 << call->getArg(1)->getSourceRange();
125}
126
127/// Check that the first argument to __builtin_annotation is an integer
128/// and the second argument is a non-wide string literal.
129static bool SemaBuiltinAnnotation(Sema &S, CallExpr *TheCall) {
130 if (checkArgCount(S, TheCall, 2))
131 return true;
132
133 // First argument should be an integer.
134 Expr *ValArg = TheCall->getArg(0);
135 QualType Ty = ValArg->getType();
136 if (!Ty->isIntegerType()) {
137 S.Diag(ValArg->getBeginLoc(), diag::err_builtin_annotation_first_arg)
138 << ValArg->getSourceRange();
139 return true;
140 }
141
142 // Second argument should be a constant string.
143 Expr *StrArg = TheCall->getArg(1)->IgnoreParenCasts();
144 StringLiteral *Literal = dyn_cast<StringLiteral>(StrArg);
145 if (!Literal || !Literal->isAscii()) {
146 S.Diag(StrArg->getBeginLoc(), diag::err_builtin_annotation_second_arg)
147 << StrArg->getSourceRange();
148 return true;
149 }
150
151 TheCall->setType(Ty);
152 return false;
153}
154
155static bool SemaBuiltinMSVCAnnotation(Sema &S, CallExpr *TheCall) {
156 // We need at least one argument.
157 if (TheCall->getNumArgs() < 1) {
158 S.Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args_at_least)
159 << 0 << 1 << TheCall->getNumArgs()
160 << TheCall->getCallee()->getSourceRange();
161 return true;
162 }
163
164 // All arguments should be wide string literals.
165 for (Expr *Arg : TheCall->arguments()) {
166 auto *Literal = dyn_cast<StringLiteral>(Arg->IgnoreParenCasts());
167 if (!Literal || !Literal->isWide()) {
168 S.Diag(Arg->getBeginLoc(), diag::err_msvc_annotation_wide_str)
169 << Arg->getSourceRange();
170 return true;
171 }
172 }
173
174 return false;
175}
176
177/// Check that the argument to __builtin_addressof is a glvalue, and set the
178/// result type to the corresponding pointer type.
179static bool SemaBuiltinAddressof(Sema &S, CallExpr *TheCall) {
180 if (checkArgCount(S, TheCall, 1))
181 return true;
182
183 ExprResult Arg(TheCall->getArg(0));
184 QualType ResultType = S.CheckAddressOfOperand(Arg, TheCall->getBeginLoc());
185 if (ResultType.isNull())
186 return true;
187
188 TheCall->setArg(0, Arg.get());
189 TheCall->setType(ResultType);
190 return false;
191}
192
193static bool SemaBuiltinOverflow(Sema &S, CallExpr *TheCall) {
194 if (checkArgCount(S, TheCall, 3))
195 return true;
196
197 // First two arguments should be integers.
198 for (unsigned I = 0; I < 2; ++I) {
199 ExprResult Arg = TheCall->getArg(I);
200 QualType Ty = Arg.get()->getType();
201 if (!Ty->isIntegerType()) {
202 S.Diag(Arg.get()->getBeginLoc(), diag::err_overflow_builtin_must_be_int)
203 << Ty << Arg.get()->getSourceRange();
204 return true;
205 }
206 InitializedEntity Entity = InitializedEntity::InitializeParameter(
207 S.getASTContext(), Ty, /*consume*/ false);
208 Arg = S.PerformCopyInitialization(Entity, SourceLocation(), Arg);
209 if (Arg.isInvalid())
210 return true;
211 TheCall->setArg(I, Arg.get());
212 }
213
214 // Third argument should be a pointer to a non-const integer.
215 // IRGen correctly handles volatile, restrict, and address spaces, and
216 // the other qualifiers aren't possible.
217 {
218 ExprResult Arg = TheCall->getArg(2);
219 QualType Ty = Arg.get()->getType();
220 const auto *PtrTy = Ty->getAs<PointerType>();
221 if (!(PtrTy && PtrTy->getPointeeType()->isIntegerType() &&
222 !PtrTy->getPointeeType().isConstQualified())) {
223 S.Diag(Arg.get()->getBeginLoc(),
224 diag::err_overflow_builtin_must_be_ptr_int)
225 << Ty << Arg.get()->getSourceRange();
226 return true;
227 }
228 InitializedEntity Entity = InitializedEntity::InitializeParameter(
229 S.getASTContext(), Ty, /*consume*/ false);
230 Arg = S.PerformCopyInitialization(Entity, SourceLocation(), Arg);
231 if (Arg.isInvalid())
232 return true;
233 TheCall->setArg(2, Arg.get());
234 }
235 return false;
236}
237
238static void SemaBuiltinMemChkCall(Sema &S, FunctionDecl *FDecl,
239 CallExpr *TheCall, unsigned SizeIdx,
240 unsigned DstSizeIdx,
241 StringRef LikelyMacroName) {
242 if (TheCall->getNumArgs() <= SizeIdx ||
243 TheCall->getNumArgs() <= DstSizeIdx)
244 return;
245
246 const Expr *SizeArg = TheCall->getArg(SizeIdx);
247 const Expr *DstSizeArg = TheCall->getArg(DstSizeIdx);
248
249 Expr::EvalResult SizeResult, DstSizeResult;
250
251 // find out if both sizes are known at compile time
252 if (!SizeArg->EvaluateAsInt(SizeResult, S.Context) ||
253 !DstSizeArg->EvaluateAsInt(DstSizeResult, S.Context))
254 return;
255
256 llvm::APSInt Size = SizeResult.Val.getInt();
257 llvm::APSInt DstSize = DstSizeResult.Val.getInt();
258
259 if (Size.ule(DstSize))
260 return;
261
262 // Confirmed overflow, so generate the diagnostic.
263 StringRef FunctionName = FDecl->getName();
264 SourceLocation SL = TheCall->getBeginLoc();
265 SourceManager &SM = S.getSourceManager();
266 // If we're in an expansion of a macro whose name corresponds to this builtin,
267 // use the simple macro name and location.
268 if (SL.isMacroID() && Lexer::getImmediateMacroName(SL, SM, S.getLangOpts()) ==
269 LikelyMacroName) {
270 FunctionName = LikelyMacroName;
271 SL = SM.getImmediateMacroCallerLoc(SL);
272 }
273
274 S.Diag(SL, diag::warn_memcpy_chk_overflow)
275 << FunctionName << DstSize.toString(/*Radix=*/10)
276 << Size.toString(/*Radix=*/10);
277}
278
279static bool SemaBuiltinCallWithStaticChain(Sema &S, CallExpr *BuiltinCall) {
280 if (checkArgCount(S, BuiltinCall, 2))
281 return true;
282
283 SourceLocation BuiltinLoc = BuiltinCall->getBeginLoc();
284 Expr *Builtin = BuiltinCall->getCallee()->IgnoreImpCasts();
285 Expr *Call = BuiltinCall->getArg(0);
286 Expr *Chain = BuiltinCall->getArg(1);
287
288 if (Call->getStmtClass() != Stmt::CallExprClass) {
289 S.Diag(BuiltinLoc, diag::err_first_argument_to_cwsc_not_call)
290 << Call->getSourceRange();
291 return true;
292 }
293
294 auto CE = cast<CallExpr>(Call);
295 if (CE->getCallee()->getType()->isBlockPointerType()) {
296 S.Diag(BuiltinLoc, diag::err_first_argument_to_cwsc_block_call)
297 << Call->getSourceRange();
298 return true;
299 }
300
301 const Decl *TargetDecl = CE->getCalleeDecl();
302 if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(TargetDecl))
303 if (FD->getBuiltinID()) {
304 S.Diag(BuiltinLoc, diag::err_first_argument_to_cwsc_builtin_call)
305 << Call->getSourceRange();
306 return true;
307 }
308
309 if (isa<CXXPseudoDestructorExpr>(CE->getCallee()->IgnoreParens())) {
310 S.Diag(BuiltinLoc, diag::err_first_argument_to_cwsc_pdtor_call)
311 << Call->getSourceRange();
312 return true;
313 }
314
315 ExprResult ChainResult = S.UsualUnaryConversions(Chain);
316 if (ChainResult.isInvalid())
317 return true;
318 if (!ChainResult.get()->getType()->isPointerType()) {
319 S.Diag(BuiltinLoc, diag::err_second_argument_to_cwsc_not_pointer)
320 << Chain->getSourceRange();
321 return true;
322 }
323
324 QualType ReturnTy = CE->getCallReturnType(S.Context);
325 QualType ArgTys[2] = { ReturnTy, ChainResult.get()->getType() };
326 QualType BuiltinTy = S.Context.getFunctionType(
327 ReturnTy, ArgTys, FunctionProtoType::ExtProtoInfo());
328 QualType BuiltinPtrTy = S.Context.getPointerType(BuiltinTy);
329
330 Builtin =
331 S.ImpCastExprToType(Builtin, BuiltinPtrTy, CK_BuiltinFnToFnPtr).get();
332
333 BuiltinCall->setType(CE->getType());
334 BuiltinCall->setValueKind(CE->getValueKind());
335 BuiltinCall->setObjectKind(CE->getObjectKind());
336 BuiltinCall->setCallee(Builtin);
337 BuiltinCall->setArg(1, ChainResult.get());
338
339 return false;
340}
341
342static bool SemaBuiltinSEHScopeCheck(Sema &SemaRef, CallExpr *TheCall,
343 Scope::ScopeFlags NeededScopeFlags,
344 unsigned DiagID) {
345 // Scopes aren't available during instantiation. Fortunately, builtin
346 // functions cannot be template args so they cannot be formed through template
347 // instantiation. Therefore checking once during the parse is sufficient.
348 if (SemaRef.inTemplateInstantiation())
349 return false;
350
351 Scope *S = SemaRef.getCurScope();
352 while (S && !S->isSEHExceptScope())
353 S = S->getParent();
354 if (!S || !(S->getFlags() & NeededScopeFlags)) {
355 auto *DRE = cast<DeclRefExpr>(TheCall->getCallee()->IgnoreParenCasts());
356 SemaRef.Diag(TheCall->getExprLoc(), DiagID)
357 << DRE->getDecl()->getIdentifier();
358 return true;
359 }
360
361 return false;
362}
363
364static inline bool isBlockPointer(Expr *Arg) {
365 return Arg->getType()->isBlockPointerType();
366}
367
368/// OpenCL C v2.0, s6.13.17.2 - Checks that the block parameters are all local
369/// void*, which is a requirement of device side enqueue.
370static bool checkOpenCLBlockArgs(Sema &S, Expr *BlockArg) {
371 const BlockPointerType *BPT =
372 cast<BlockPointerType>(BlockArg->getType().getCanonicalType());
373 ArrayRef<QualType> Params =
374 BPT->getPointeeType()->getAs<FunctionProtoType>()->getParamTypes();
375 unsigned ArgCounter = 0;
376 bool IllegalParams = false;
377 // Iterate through the block parameters until either one is found that is not
378 // a local void*, or the block is valid.
379 for (ArrayRef<QualType>::iterator I = Params.begin(), E = Params.end();
380 I != E; ++I, ++ArgCounter) {
381 if (!(*I)->isPointerType() || !(*I)->getPointeeType()->isVoidType() ||
382 (*I)->getPointeeType().getQualifiers().getAddressSpace() !=
383 LangAS::opencl_local) {
384 // Get the location of the error. If a block literal has been passed
385 // (BlockExpr) then we can point straight to the offending argument,
386 // else we just point to the variable reference.
387 SourceLocation ErrorLoc;
388 if (isa<BlockExpr>(BlockArg)) {
389 BlockDecl *BD = cast<BlockExpr>(BlockArg)->getBlockDecl();
390 ErrorLoc = BD->getParamDecl(ArgCounter)->getBeginLoc();
391 } else if (isa<DeclRefExpr>(BlockArg)) {
392 ErrorLoc = cast<DeclRefExpr>(BlockArg)->getBeginLoc();
393 }
394 S.Diag(ErrorLoc,
395 diag::err_opencl_enqueue_kernel_blocks_non_local_void_args);
396 IllegalParams = true;
397 }
398 }
399
400 return IllegalParams;
401}
402
403static bool checkOpenCLSubgroupExt(Sema &S, CallExpr *Call) {
404 if (!S.getOpenCLOptions().isEnabled("cl_khr_subgroups")) {
405 S.Diag(Call->getBeginLoc(), diag::err_opencl_requires_extension)
406 << 1 << Call->getDirectCallee() << "cl_khr_subgroups";
407 return true;
408 }
409 return false;
410}
411
412static bool SemaOpenCLBuiltinNDRangeAndBlock(Sema &S, CallExpr *TheCall) {
413 if (checkArgCount(S, TheCall, 2))
414 return true;
415
416 if (checkOpenCLSubgroupExt(S, TheCall))
417 return true;
418
419 // First argument is an ndrange_t type.
420 Expr *NDRangeArg = TheCall->getArg(0);
421 if (NDRangeArg->getType().getUnqualifiedType().getAsString() != "ndrange_t") {
422 S.Diag(NDRangeArg->getBeginLoc(), diag::err_opencl_builtin_expected_type)
423 << TheCall->getDirectCallee() << "'ndrange_t'";
424 return true;
425 }
426
427 Expr *BlockArg = TheCall->getArg(1);
428 if (!isBlockPointer(BlockArg)) {
429 S.Diag(BlockArg->getBeginLoc(), diag::err_opencl_builtin_expected_type)
430 << TheCall->getDirectCallee() << "block";
431 return true;
432 }
433 return checkOpenCLBlockArgs(S, BlockArg);
434}
435
436/// OpenCL C v2.0, s6.13.17.6 - Check the argument to the
437/// get_kernel_work_group_size
438/// and get_kernel_preferred_work_group_size_multiple builtin functions.
439static bool SemaOpenCLBuiltinKernelWorkGroupSize(Sema &S, CallExpr *TheCall) {
440 if (checkArgCount(S, TheCall, 1))
441 return true;
442
443 Expr *BlockArg = TheCall->getArg(0);
444 if (!isBlockPointer(BlockArg)) {
445 S.Diag(BlockArg->getBeginLoc(), diag::err_opencl_builtin_expected_type)
446 << TheCall->getDirectCallee() << "block";
447 return true;
448 }
449 return checkOpenCLBlockArgs(S, BlockArg);
450}
451
452/// Diagnose integer type and any valid implicit conversion to it.
453static bool checkOpenCLEnqueueIntType(Sema &S, Expr *E,
454 const QualType &IntType);
455
456static bool checkOpenCLEnqueueLocalSizeArgs(Sema &S, CallExpr *TheCall,
457 unsigned Start, unsigned End) {
458 bool IllegalParams = false;
459 for (unsigned I = Start; I <= End; ++I)
460 IllegalParams |= checkOpenCLEnqueueIntType(S, TheCall->getArg(I),
461 S.Context.getSizeType());
462 return IllegalParams;
463}
464
465/// OpenCL v2.0, s6.13.17.1 - Check that sizes are provided for all
466/// 'local void*' parameter of passed block.
467static bool checkOpenCLEnqueueVariadicArgs(Sema &S, CallExpr *TheCall,
468 Expr *BlockArg,
469 unsigned NumNonVarArgs) {
470 const BlockPointerType *BPT =
471 cast<BlockPointerType>(BlockArg->getType().getCanonicalType());
472 unsigned NumBlockParams =
473 BPT->getPointeeType()->getAs<FunctionProtoType>()->getNumParams();
474 unsigned TotalNumArgs = TheCall->getNumArgs();
475
476 // For each argument passed to the block, a corresponding uint needs to
477 // be passed to describe the size of the local memory.
478 if (TotalNumArgs != NumBlockParams + NumNonVarArgs) {
479 S.Diag(TheCall->getBeginLoc(),
480 diag::err_opencl_enqueue_kernel_local_size_args);
481 return true;
482 }
483
484 // Check that the sizes of the local memory are specified by integers.
485 return checkOpenCLEnqueueLocalSizeArgs(S, TheCall, NumNonVarArgs,
486 TotalNumArgs - 1);
487}
488
489/// OpenCL C v2.0, s6.13.17 - Enqueue kernel function contains four different
490/// overload formats specified in Table 6.13.17.1.
491/// int enqueue_kernel(queue_t queue,
492/// kernel_enqueue_flags_t flags,
493/// const ndrange_t ndrange,
494/// void (^block)(void))
495/// int enqueue_kernel(queue_t queue,
496/// kernel_enqueue_flags_t flags,
497/// const ndrange_t ndrange,
498/// uint num_events_in_wait_list,
499/// clk_event_t *event_wait_list,
500/// clk_event_t *event_ret,
501/// void (^block)(void))
502/// int enqueue_kernel(queue_t queue,
503/// kernel_enqueue_flags_t flags,
504/// const ndrange_t ndrange,
505/// void (^block)(local void*, ...),
506/// uint size0, ...)
507/// int enqueue_kernel(queue_t queue,
508/// kernel_enqueue_flags_t flags,
509/// const ndrange_t ndrange,
510/// uint num_events_in_wait_list,
511/// clk_event_t *event_wait_list,
512/// clk_event_t *event_ret,
513/// void (^block)(local void*, ...),
514/// uint size0, ...)
515static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
516 unsigned NumArgs = TheCall->getNumArgs();
517
518 if (NumArgs < 4) {
519 S.Diag(TheCall->getBeginLoc(), diag::err_typecheck_call_too_few_args);
520 return true;
521 }
522
523 Expr *Arg0 = TheCall->getArg(0);
524 Expr *Arg1 = TheCall->getArg(1);
525 Expr *Arg2 = TheCall->getArg(2);
526 Expr *Arg3 = TheCall->getArg(3);
527
528 // First argument always needs to be a queue_t type.
529 if (!Arg0->getType()->isQueueT()) {
530 S.Diag(TheCall->getArg(0)->getBeginLoc(),
531 diag::err_opencl_builtin_expected_type)
532 << TheCall->getDirectCallee() << S.Context.OCLQueueTy;
533 return true;
534 }
535
536 // Second argument always needs to be a kernel_enqueue_flags_t enum value.
537 if (!Arg1->getType()->isIntegerType()) {
538 S.Diag(TheCall->getArg(1)->getBeginLoc(),
539 diag::err_opencl_builtin_expected_type)
540 << TheCall->getDirectCallee() << "'kernel_enqueue_flags_t' (i.e. uint)";
541 return true;
542 }
543
544 // Third argument is always an ndrange_t type.
545 if (Arg2->getType().getUnqualifiedType().getAsString() != "ndrange_t") {
546 S.Diag(TheCall->getArg(2)->getBeginLoc(),
547 diag::err_opencl_builtin_expected_type)
548 << TheCall->getDirectCallee() << "'ndrange_t'";
549 return true;
550 }
551
552 // With four arguments, there is only one form that the function could be
553 // called in: no events and no variable arguments.
554 if (NumArgs == 4) {
555 // check that the last argument is the right block type.
556 if (!isBlockPointer(Arg3)) {
557 S.Diag(Arg3->getBeginLoc(), diag::err_opencl_builtin_expected_type)
558 << TheCall->getDirectCallee() << "block";
559 return true;
560 }
561 // we have a block type, check the prototype
562 const BlockPointerType *BPT =
563 cast<BlockPointerType>(Arg3->getType().getCanonicalType());
564 if (BPT->getPointeeType()->getAs<FunctionProtoType>()->getNumParams() > 0) {
565 S.Diag(Arg3->getBeginLoc(),
566 diag::err_opencl_enqueue_kernel_blocks_no_args);
567 return true;
568 }
569 return false;
570 }
571 // we can have block + varargs.
572 if (isBlockPointer(Arg3))
573 return (checkOpenCLBlockArgs(S, Arg3) ||
574 checkOpenCLEnqueueVariadicArgs(S, TheCall, Arg3, 4));
575 // last two cases with either exactly 7 args or 7 args and varargs.
576 if (NumArgs >= 7) {
577 // check common block argument.
578 Expr *Arg6 = TheCall->getArg(6);
579 if (!isBlockPointer(Arg6)) {
580 S.Diag(Arg6->getBeginLoc(), diag::err_opencl_builtin_expected_type)
581 << TheCall->getDirectCallee() << "block";
582 return true;
583 }
584 if (checkOpenCLBlockArgs(S, Arg6))
585 return true;
586
587 // Forth argument has to be any integer type.
588 if (!Arg3->getType()->isIntegerType()) {
589 S.Diag(TheCall->getArg(3)->getBeginLoc(),
590 diag::err_opencl_builtin_expected_type)
591 << TheCall->getDirectCallee() << "integer";
592 return true;
593 }
594 // check remaining common arguments.
595 Expr *Arg4 = TheCall->getArg(4);
596 Expr *Arg5 = TheCall->getArg(5);
597
598 // Fifth argument is always passed as a pointer to clk_event_t.
599 if (!Arg4->isNullPointerConstant(S.Context,
600 Expr::NPC_ValueDependentIsNotNull) &&
601 !Arg4->getType()->getPointeeOrArrayElementType()->isClkEventT()) {
602 S.Diag(TheCall->getArg(4)->getBeginLoc(),
603 diag::err_opencl_builtin_expected_type)
604 << TheCall->getDirectCallee()
605 << S.Context.getPointerType(S.Context.OCLClkEventTy);
606 return true;
607 }
608
609 // Sixth argument is always passed as a pointer to clk_event_t.
610 if (!Arg5->isNullPointerConstant(S.Context,
611 Expr::NPC_ValueDependentIsNotNull) &&
612 !(Arg5->getType()->isPointerType() &&
613 Arg5->getType()->getPointeeType()->isClkEventT())) {
614 S.Diag(TheCall->getArg(5)->getBeginLoc(),
615 diag::err_opencl_builtin_expected_type)
616 << TheCall->getDirectCallee()
617 << S.Context.getPointerType(S.Context.OCLClkEventTy);
618 return true;
619 }
620
621 if (NumArgs == 7)
622 return false;
623
624 return checkOpenCLEnqueueVariadicArgs(S, TheCall, Arg6, 7);
625 }
626
627 // None of the specific case has been detected, give generic error
628 S.Diag(TheCall->getBeginLoc(),
629 diag::err_opencl_enqueue_kernel_incorrect_args);
630 return true;
631}
632
633/// Returns OpenCL access qual.
634static OpenCLAccessAttr *getOpenCLArgAccess(const Decl *D) {
635 return D->getAttr<OpenCLAccessAttr>();
636}
637
638/// Returns true if pipe element type is different from the pointer.
639static bool checkOpenCLPipeArg(Sema &S, CallExpr *Call) {
640 const Expr *Arg0 = Call->getArg(0);
641 // First argument type should always be pipe.
642 if (!Arg0->getType()->isPipeType()) {
643 S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_first_arg)
644 << Call->getDirectCallee() << Arg0->getSourceRange();
645 return true;
646 }
647 OpenCLAccessAttr *AccessQual =
648 getOpenCLArgAccess(cast<DeclRefExpr>(Arg0)->getDecl());
649 // Validates the access qualifier is compatible with the call.
650 // OpenCL v2.0 s6.13.16 - The access qualifiers for pipe should only be
651 // read_only and write_only, and assumed to be read_only if no qualifier is
652 // specified.
653 switch (Call->getDirectCallee()->getBuiltinID()) {
654 case Builtin::BIread_pipe:
655 case Builtin::BIreserve_read_pipe:
656 case Builtin::BIcommit_read_pipe:
657 case Builtin::BIwork_group_reserve_read_pipe:
658 case Builtin::BIsub_group_reserve_read_pipe:
659 case Builtin::BIwork_group_commit_read_pipe:
660 case Builtin::BIsub_group_commit_read_pipe:
661 if (!(!AccessQual || AccessQual->isReadOnly())) {
662 S.Diag(Arg0->getBeginLoc(),
663 diag::err_opencl_builtin_pipe_invalid_access_modifier)
664 << "read_only" << Arg0->getSourceRange();
665 return true;
666 }
667 break;
668 case Builtin::BIwrite_pipe:
669 case Builtin::BIreserve_write_pipe:
670 case Builtin::BIcommit_write_pipe:
671 case Builtin::BIwork_group_reserve_write_pipe:
672 case Builtin::BIsub_group_reserve_write_pipe:
673 case Builtin::BIwork_group_commit_write_pipe:
674 case Builtin::BIsub_group_commit_write_pipe:
675 if (!(AccessQual && AccessQual->isWriteOnly())) {
676 S.Diag(Arg0->getBeginLoc(),
677 diag::err_opencl_builtin_pipe_invalid_access_modifier)
678 << "write_only" << Arg0->getSourceRange();
679 return true;
680 }
681 break;
682 default:
683 break;
684 }
685 return false;
686}
687
688/// Returns true if pipe element type is different from the pointer.
689static bool checkOpenCLPipePacketType(Sema &S, CallExpr *Call, unsigned Idx) {
690 const Expr *Arg0 = Call->getArg(0);
691 const Expr *ArgIdx = Call->getArg(Idx);
692 const PipeType *PipeTy = cast<PipeType>(Arg0->getType());
693 const QualType EltTy = PipeTy->getElementType();
694 const PointerType *ArgTy = ArgIdx->getType()->getAs<PointerType>();
695 // The Idx argument should be a pointer and the type of the pointer and
696 // the type of pipe element should also be the same.
697 if (!ArgTy ||
698 !S.Context.hasSameType(
699 EltTy, ArgTy->getPointeeType()->getCanonicalTypeInternal())) {
700 S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg)
701 << Call->getDirectCallee() << S.Context.getPointerType(EltTy)
702 << ArgIdx->getType() << ArgIdx->getSourceRange();
703 return true;
704 }
705 return false;
706}
707
708// Performs semantic analysis for the read/write_pipe call.
709// \param S Reference to the semantic analyzer.
710// \param Call A pointer to the builtin call.
711// \return True if a semantic error has been found, false otherwise.
712static bool SemaBuiltinRWPipe(Sema &S, CallExpr *Call) {
713 // OpenCL v2.0 s6.13.16.2 - The built-in read/write
714 // functions have two forms.
715 switch (Call->getNumArgs()) {
716 case 2:
717 if (checkOpenCLPipeArg(S, Call))
718 return true;
719 // The call with 2 arguments should be
720 // read/write_pipe(pipe T, T*).
721 // Check packet type T.
722 if (checkOpenCLPipePacketType(S, Call, 1))
723 return true;
724 break;
725
726 case 4: {
727 if (checkOpenCLPipeArg(S, Call))
728 return true;
729 // The call with 4 arguments should be
730 // read/write_pipe(pipe T, reserve_id_t, uint, T*).
731 // Check reserve_id_t.
732 if (!Call->getArg(1)->getType()->isReserveIDT()) {
733 S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg)
734 << Call->getDirectCallee() << S.Context.OCLReserveIDTy
735 << Call->getArg(1)->getType() << Call->getArg(1)->getSourceRange();
736 return true;
737 }
738
739 // Check the index.
740 const Expr *Arg2 = Call->getArg(2);
741 if (!Arg2->getType()->isIntegerType() &&
742 !Arg2->getType()->isUnsignedIntegerType()) {
743 S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg)
744 << Call->getDirectCallee() << S.Context.UnsignedIntTy
745 << Arg2->getType() << Arg2->getSourceRange();
746 return true;
747 }
748
749 // Check packet type T.
750 if (checkOpenCLPipePacketType(S, Call, 3))
751 return true;
752 } break;
753 default:
754 S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_arg_num)
755 << Call->getDirectCallee() << Call->getSourceRange();
756 return true;
757 }
758
759 return false;
760}
761
762// Performs a semantic analysis on the {work_group_/sub_group_
763// /_}reserve_{read/write}_pipe
764// \param S Reference to the semantic analyzer.
765// \param Call The call to the builtin function to be analyzed.
766// \return True if a semantic error was found, false otherwise.
767static bool SemaBuiltinReserveRWPipe(Sema &S, CallExpr *Call) {
768 if (checkArgCount(S, Call, 2))
769 return true;
770
771 if (checkOpenCLPipeArg(S, Call))
772 return true;
773
774 // Check the reserve size.
775 if (!Call->getArg(1)->getType()->isIntegerType() &&
776 !Call->getArg(1)->getType()->isUnsignedIntegerType()) {
777 S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg)
778 << Call->getDirectCallee() << S.Context.UnsignedIntTy
779 << Call->getArg(1)->getType() << Call->getArg(1)->getSourceRange();
780 return true;
781 }
782
783 // Since return type of reserve_read/write_pipe built-in function is
784 // reserve_id_t, which is not defined in the builtin def file , we used int
785 // as return type and need to override the return type of these functions.
786 Call->setType(S.Context.OCLReserveIDTy);
787
788 return false;
789}
790
791// Performs a semantic analysis on {work_group_/sub_group_
792// /_}commit_{read/write}_pipe
793// \param S Reference to the semantic analyzer.
794// \param Call The call to the builtin function to be analyzed.
795// \return True if a semantic error was found, false otherwise.
796static bool SemaBuiltinCommitRWPipe(Sema &S, CallExpr *Call) {
797 if (checkArgCount(S, Call, 2))
798 return true;
799
800 if (checkOpenCLPipeArg(S, Call))
801 return true;
802
803 // Check reserve_id_t.
804 if (!Call->getArg(1)->getType()->isReserveIDT()) {
805 S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg)
806 << Call->getDirectCallee() << S.Context.OCLReserveIDTy
807 << Call->getArg(1)->getType() << Call->getArg(1)->getSourceRange();
808 return true;
809 }
810
811 return false;
812}
813
814// Performs a semantic analysis on the call to built-in Pipe
815// Query Functions.
816// \param S Reference to the semantic analyzer.
817// \param Call The call to the builtin function to be analyzed.
818// \return True if a semantic error was found, false otherwise.
819static bool SemaBuiltinPipePackets(Sema &S, CallExpr *Call) {
820 if (checkArgCount(S, Call, 1))
821 return true;
822
823 if (!Call->getArg(0)->getType()->isPipeType()) {
824 S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_first_arg)
825 << Call->getDirectCallee() << Call->getArg(0)->getSourceRange();
826 return true;
827 }
828
829 return false;
830}
831
832// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
833// Performs semantic analysis for the to_global/local/private call.
834// \param S Reference to the semantic analyzer.
835// \param BuiltinID ID of the builtin function.
836// \param Call A pointer to the builtin call.
837// \return True if a semantic error has been found, false otherwise.
838static bool SemaOpenCLBuiltinToAddr(Sema &S, unsigned BuiltinID,
839 CallExpr *Call) {
840 if (Call->getNumArgs() != 1) {
841 S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_to_addr_arg_num)
842 << Call->getDirectCallee() << Call->getSourceRange();
843 return true;
844 }
845
846 auto RT = Call->getArg(0)->getType();
847 if (!RT->isPointerType() || RT->getPointeeType()
848 .getAddressSpace() == LangAS::opencl_constant) {
849 S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_to_addr_invalid_arg)
850 << Call->getArg(0) << Call->getDirectCallee() << Call->getSourceRange();
851 return true;
852 }
853
854 if (RT->getPointeeType().getAddressSpace() != LangAS::opencl_generic) {
855 S.Diag(Call->getArg(0)->getBeginLoc(),
856 diag::warn_opencl_generic_address_space_arg)
857 << Call->getDirectCallee()->getNameInfo().getAsString()
858 << Call->getArg(0)->getSourceRange();
859 }
860
861 RT = RT->getPointeeType();
862 auto Qual = RT.getQualifiers();
863 switch (BuiltinID) {
864 case Builtin::BIto_global:
865 Qual.setAddressSpace(LangAS::opencl_global);
866 break;
867 case Builtin::BIto_local:
868 Qual.setAddressSpace(LangAS::opencl_local);
869 break;
870 case Builtin::BIto_private:
871 Qual.setAddressSpace(LangAS::opencl_private);
872 break;
873 default:
874 llvm_unreachable("Invalid builtin function");
875 }
876 Call->setType(S.Context.getPointerType(S.Context.getQualifiedType(
877 RT.getUnqualifiedType(), Qual)));
878
879 return false;
880}
881
882static ExprResult SemaBuiltinLaunder(Sema &S, CallExpr *TheCall) {
883 if (checkArgCount(S, TheCall, 1))
884 return ExprError();
885
886 // Compute __builtin_launder's parameter type from the argument.
887 // The parameter type is:
888 // * The type of the argument if it's not an array or function type,
889 // Otherwise,
890 // * The decayed argument type.
891 QualType ParamTy = [&]() {
892 QualType ArgTy = TheCall->getArg(0)->getType();
893 if (const ArrayType *Ty = ArgTy->getAsArrayTypeUnsafe())
894 return S.Context.getPointerType(Ty->getElementType());
895 if (ArgTy->isFunctionType()) {
896 return S.Context.getPointerType(ArgTy);
897 }
898 return ArgTy;
899 }();
900
901 TheCall->setType(ParamTy);
902
903 auto DiagSelect = [&]() -> llvm::Optional<unsigned> {
904 if (!ParamTy->isPointerType())
905 return 0;
906 if (ParamTy->isFunctionPointerType())
907 return 1;
908 if (ParamTy->isVoidPointerType())
909 return 2;
910 return llvm::Optional<unsigned>{};
911 }();
912 if (DiagSelect.hasValue()) {
913 S.Diag(TheCall->getBeginLoc(), diag::err_builtin_launder_invalid_arg)
914 << DiagSelect.getValue() << TheCall->getSourceRange();
915 return ExprError();
916 }
917
918 // We either have an incomplete class type, or we have a class template
919 // whose instantiation has not been forced. Example:
920 //
921 // template <class T> struct Foo { T value; };
922 // Foo<int> *p = nullptr;
923 // auto *d = __builtin_launder(p);
924 if (S.RequireCompleteType(TheCall->getBeginLoc(), ParamTy->getPointeeType(),
925 diag::err_incomplete_type))
926 return ExprError();
927
928 assert(ParamTy->getPointeeType()->isObjectType() &&
929 "Unhandled non-object pointer case");
930
931 InitializedEntity Entity =
932 InitializedEntity::InitializeParameter(S.Context, ParamTy, false);
933 ExprResult Arg =
934 S.PerformCopyInitialization(Entity, SourceLocation(), TheCall->getArg(0));
935 if (Arg.isInvalid())
936 return ExprError();
937 TheCall->setArg(0, Arg.get());
938
939 return TheCall;
940}
941
942// Emit an error and return true if the current architecture is not in the list
943// of supported architectures.
944static bool
945CheckBuiltinTargetSupport(Sema &S, unsigned BuiltinID, CallExpr *TheCall,
946 ArrayRef<llvm::Triple::ArchType> SupportedArchs) {
947 llvm::Triple::ArchType CurArch =
948 S.getASTContext().getTargetInfo().getTriple().getArch();
949 if (llvm::is_contained(SupportedArchs, CurArch))
950 return false;
951 S.Diag(TheCall->getBeginLoc(), diag::err_builtin_target_unsupported)
952 << TheCall->getSourceRange();
953 return true;
954}
955
956ExprResult
957Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
958 CallExpr *TheCall) {
959 ExprResult TheCallResult(TheCall);
960
961 // Find out if any arguments are required to be integer constant expressions.
962 unsigned ICEArguments = 0;
963 ASTContext::GetBuiltinTypeError Error;
964 Context.GetBuiltinType(BuiltinID, Error, &ICEArguments);
965 if (Error != ASTContext::GE_None)
966 ICEArguments = 0; // Don't diagnose previously diagnosed errors.
967
968 // If any arguments are required to be ICE's, check and diagnose.
969 for (unsigned ArgNo = 0; ICEArguments != 0; ++ArgNo) {
970 // Skip arguments not required to be ICE's.
971 if ((ICEArguments & (1 << ArgNo)) == 0) continue;
972
973 llvm::APSInt Result;
974 if (SemaBuiltinConstantArg(TheCall, ArgNo, Result))
975 return true;
976 ICEArguments &= ~(1 << ArgNo);
977 }
978
979 switch (BuiltinID) {
980 case Builtin::BI__builtin___CFStringMakeConstantString:
981 assert(TheCall->getNumArgs() == 1 &&
982 "Wrong # arguments to builtin CFStringMakeConstantString");
983 if (CheckObjCString(TheCall->getArg(0)))
984 return ExprError();
985 break;
986 case Builtin::BI__builtin_ms_va_start:
987 case Builtin::BI__builtin_stdarg_start:
988 case Builtin::BI__builtin_va_start:
989 if (SemaBuiltinVAStart(BuiltinID, TheCall))
990 return ExprError();
991 break;
992 case Builtin::BI__va_start: {
993 switch (Context.getTargetInfo().getTriple().getArch()) {
994 case llvm::Triple::aarch64:
995 case llvm::Triple::arm:
996 case llvm::Triple::thumb:
997 if (SemaBuiltinVAStartARMMicrosoft(TheCall))
998 return ExprError();
999 break;
1000 default:
1001 if (SemaBuiltinVAStart(BuiltinID, TheCall))
1002 return ExprError();
1003 break;
1004 }
1005 break;
1006 }
1007
1008 // The acquire, release, and no fence variants are ARM and AArch64 only.
1009 case Builtin::BI_interlockedbittestandset_acq:
1010 case Builtin::BI_interlockedbittestandset_rel:
1011 case Builtin::BI_interlockedbittestandset_nf:
1012 case Builtin::BI_interlockedbittestandreset_acq:
1013 case Builtin::BI_interlockedbittestandreset_rel:
1014 case Builtin::BI_interlockedbittestandreset_nf:
1015 if (CheckBuiltinTargetSupport(
1016 *this, BuiltinID, TheCall,
1017 {llvm::Triple::arm, llvm::Triple::thumb, llvm::Triple::aarch64}))
1018 return ExprError();
1019 break;
1020
1021 // The 64-bit bittest variants are x64, ARM, and AArch64 only.
1022 case Builtin::BI_bittest64:
1023 case Builtin::BI_bittestandcomplement64:
1024 case Builtin::BI_bittestandreset64:
1025 case Builtin::BI_bittestandset64:
1026 case Builtin::BI_interlockedbittestandreset64:
1027 case Builtin::BI_interlockedbittestandset64:
1028 if (CheckBuiltinTargetSupport(*this, BuiltinID, TheCall,
1029 {llvm::Triple::x86_64, llvm::Triple::arm,
1030 llvm::Triple::thumb, llvm::Triple::aarch64}))
1031 return ExprError();
1032 break;
1033
1034 case Builtin::BI__builtin_isgreater:
1035 case Builtin::BI__builtin_isgreaterequal:
1036 case Builtin::BI__builtin_isless:
1037 case Builtin::BI__builtin_islessequal:
1038 case Builtin::BI__builtin_islessgreater:
1039 case Builtin::BI__builtin_isunordered:
1040 if (SemaBuiltinUnorderedCompare(TheCall))
1041 return ExprError();
1042 break;
1043 case Builtin::BI__builtin_fpclassify:
1044 if (SemaBuiltinFPClassification(TheCall, 6))
1045 return ExprError();
1046 break;
1047 case Builtin::BI__builtin_isfinite:
1048 case Builtin::BI__builtin_isinf:
1049 case Builtin::BI__builtin_isinf_sign:
1050 case Builtin::BI__builtin_isnan:
1051 case Builtin::BI__builtin_isnormal:
1052 case Builtin::BI__builtin_signbit:
1053 case Builtin::BI__builtin_signbitf:
1054 case Builtin::BI__builtin_signbitl:
1055 if (SemaBuiltinFPClassification(TheCall, 1))
1056 return ExprError();
1057 break;
1058 case Builtin::BI__builtin_shufflevector:
1059 return SemaBuiltinShuffleVector(TheCall);
1060 // TheCall will be freed by the smart pointer here, but that's fine, since
1061 // SemaBuiltinShuffleVector guts it, but then doesn't release it.
1062 case Builtin::BI__builtin_prefetch:
1063 if (SemaBuiltinPrefetch(TheCall))
1064 return ExprError();
1065 break;
1066 case Builtin::BI__builtin_alloca_with_align:
1067 if (SemaBuiltinAllocaWithAlign(TheCall))
1068 return ExprError();
1069 break;
1070 case Builtin::BI__assume:
1071 case Builtin::BI__builtin_assume:
1072 if (SemaBuiltinAssume(TheCall))
1073 return ExprError();
1074 break;
1075 case Builtin::BI__builtin_assume_aligned:
1076 if (SemaBuiltinAssumeAligned(TheCall))
1077 return ExprError();
1078 break;
1079 case Builtin::BI__builtin_dynamic_object_size:
1080 case Builtin::BI__builtin_object_size:
1081 if (SemaBuiltinConstantArgRange(TheCall, 1, 0, 3))
1082 return ExprError();
1083 break;
1084 case Builtin::BI__builtin_longjmp:
1085 if (SemaBuiltinLongjmp(TheCall))
1086 return ExprError();
1087 break;
1088 case Builtin::BI__builtin_setjmp:
1089 if (SemaBuiltinSetjmp(TheCall))
1090 return ExprError();
1091 break;
1092 case Builtin::BI_setjmp:
1093 case Builtin::BI_setjmpex:
1094 if (checkArgCount(*this, TheCall, 1))
1095 return true;
1096 break;
1097 case Builtin::BI__builtin_classify_type:
1098 if (checkArgCount(*this, TheCall, 1)) return true;
1099 TheCall->setType(Context.IntTy);
1100 break;
1101 case Builtin::BI__builtin_constant_p:
1102 if (checkArgCount(*this, TheCall, 1)) return true;
1103 TheCall->setType(Context.IntTy);
1104 break;
1105 case Builtin::BI__builtin_launder:
1106 return SemaBuiltinLaunder(*this, TheCall);
1107 case Builtin::BI__sync_fetch_and_add:
1108 case Builtin::BI__sync_fetch_and_add_1:
1109 case Builtin::BI__sync_fetch_and_add_2:
1110 case Builtin::BI__sync_fetch_and_add_4:
1111 case Builtin::BI__sync_fetch_and_add_8:
1112 case Builtin::BI__sync_fetch_and_add_16:
1113 case Builtin::BI__sync_fetch_and_sub:
1114 case Builtin::BI__sync_fetch_and_sub_1:
1115 case Builtin::BI__sync_fetch_and_sub_2:
1116 case Builtin::BI__sync_fetch_and_sub_4:
1117 case Builtin::BI__sync_fetch_and_sub_8:
1118 case Builtin::BI__sync_fetch_and_sub_16:
1119 case Builtin::BI__sync_fetch_and_or:
1120 case Builtin::BI__sync_fetch_and_or_1:
1121 case Builtin::BI__sync_fetch_and_or_2:
1122 case Builtin::BI__sync_fetch_and_or_4:
1123 case Builtin::BI__sync_fetch_and_or_8:
1124 case Builtin::BI__sync_fetch_and_or_16:
1125 case Builtin::BI__sync_fetch_and_and:
1126 case Builtin::BI__sync_fetch_and_and_1:
1127 case Builtin::BI__sync_fetch_and_and_2:
1128 case Builtin::BI__sync_fetch_and_and_4:
1129 case Builtin::BI__sync_fetch_and_and_8:
1130 case Builtin::BI__sync_fetch_and_and_16:
1131 case Builtin::BI__sync_fetch_and_xor:
1132 case Builtin::BI__sync_fetch_and_xor_1:
1133 case Builtin::BI__sync_fetch_and_xor_2:
1134 case Builtin::BI__sync_fetch_and_xor_4:
1135 case Builtin::BI__sync_fetch_and_xor_8:
1136 case Builtin::BI__sync_fetch_and_xor_16:
1137 case Builtin::BI__sync_fetch_and_nand:
1138 case Builtin::BI__sync_fetch_and_nand_1:
1139 case Builtin::BI__sync_fetch_and_nand_2:
1140 case Builtin::BI__sync_fetch_and_nand_4:
1141 case Builtin::BI__sync_fetch_and_nand_8:
1142 case Builtin::BI__sync_fetch_and_nand_16:
1143 case Builtin::BI__sync_add_and_fetch:
1144 case Builtin::BI__sync_add_and_fetch_1:
1145 case Builtin::BI__sync_add_and_fetch_2:
1146 case Builtin::BI__sync_add_and_fetch_4:
1147 case Builtin::BI__sync_add_and_fetch_8:
1148 case Builtin::BI__sync_add_and_fetch_16:
1149 case Builtin::BI__sync_sub_and_fetch:
1150 case Builtin::BI__sync_sub_and_fetch_1:
1151 case Builtin::BI__sync_sub_and_fetch_2:
1152 case Builtin::BI__sync_sub_and_fetch_4:
1153 case Builtin::BI__sync_sub_and_fetch_8:
1154 case Builtin::BI__sync_sub_and_fetch_16:
1155 case Builtin::BI__sync_and_and_fetch:
1156 case Builtin::BI__sync_and_and_fetch_1:
1157 case Builtin::BI__sync_and_and_fetch_2:
1158 case Builtin::BI__sync_and_and_fetch_4:
1159 case Builtin::BI__sync_and_and_fetch_8:
1160 case Builtin::BI__sync_and_and_fetch_16:
1161 case Builtin::BI__sync_or_and_fetch:
1162 case Builtin::BI__sync_or_and_fetch_1:
1163 case Builtin::BI__sync_or_and_fetch_2:
1164 case Builtin::BI__sync_or_and_fetch_4:
1165 case Builtin::BI__sync_or_and_fetch_8:
1166 case Builtin::BI__sync_or_and_fetch_16:
1167 case Builtin::BI__sync_xor_and_fetch:
1168 case Builtin::BI__sync_xor_and_fetch_1:
1169 case Builtin::BI__sync_xor_and_fetch_2:
1170 case Builtin::BI__sync_xor_and_fetch_4:
1171 case Builtin::BI__sync_xor_and_fetch_8:
1172 case Builtin::BI__sync_xor_and_fetch_16:
1173 case Builtin::BI__sync_nand_and_fetch:
1174 case Builtin::BI__sync_nand_and_fetch_1:
1175 case Builtin::BI__sync_nand_and_fetch_2:
1176 case Builtin::BI__sync_nand_and_fetch_4:
1177 case Builtin::BI__sync_nand_and_fetch_8:
1178 case Builtin::BI__sync_nand_and_fetch_16:
1179 case Builtin::BI__sync_val_compare_and_swap:
1180 case Builtin::BI__sync_val_compare_and_swap_1:
1181 case Builtin::BI__sync_val_compare_and_swap_2:
1182 case Builtin::BI__sync_val_compare_and_swap_4:
1183 case Builtin::BI__sync_val_compare_and_swap_8:
1184 case Builtin::BI__sync_val_compare_and_swap_16:
1185 case Builtin::BI__sync_bool_compare_and_swap:
1186 case Builtin::BI__sync_bool_compare_and_swap_1:
1187 case Builtin::BI__sync_bool_compare_and_swap_2:
1188 case Builtin::BI__sync_bool_compare_and_swap_4:
1189 case Builtin::BI__sync_bool_compare_and_swap_8:
1190 case Builtin::BI__sync_bool_compare_and_swap_16:
1191 case Builtin::BI__sync_lock_test_and_set:
1192 case Builtin::BI__sync_lock_test_and_set_1:
1193 case Builtin::BI__sync_lock_test_and_set_2:
1194 case Builtin::BI__sync_lock_test_and_set_4:
1195 case Builtin::BI__sync_lock_test_and_set_8:
1196 case Builtin::BI__sync_lock_test_and_set_16:
1197 case Builtin::BI__sync_lock_release:
1198 case Builtin::BI__sync_lock_release_1:
1199 case Builtin::BI__sync_lock_release_2:
1200 case Builtin::BI__sync_lock_release_4:
1201 case Builtin::BI__sync_lock_release_8:
1202 case Builtin::BI__sync_lock_release_16:
1203 case Builtin::BI__sync_swap:
1204 case Builtin::BI__sync_swap_1:
1205 case Builtin::BI__sync_swap_2:
1206 case Builtin::BI__sync_swap_4:
1207 case Builtin::BI__sync_swap_8:
1208 case Builtin::BI__sync_swap_16:
1209 return SemaBuiltinAtomicOverloaded(TheCallResult);
1210 case Builtin::BI__sync_synchronize:
1211 Diag(TheCall->getBeginLoc(), diag::warn_atomic_implicit_seq_cst)
1212 << TheCall->getCallee()->getSourceRange();
1213 break;
1214 case Builtin::BI__builtin_nontemporal_load:
1215 case Builtin::BI__builtin_nontemporal_store:
1216 return SemaBuiltinNontemporalOverloaded(TheCallResult);
1217#define BUILTIN(ID, TYPE, ATTRS)
1218#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \
1219 case Builtin::BI##ID: \
1220 return SemaAtomicOpsOverloaded(TheCallResult, AtomicExpr::AO##ID);
1221#include "clang/Basic/Builtins.def"
1222 case Builtin::BI__annotation:
1223 if (SemaBuiltinMSVCAnnotation(*this, TheCall))
1224 return ExprError();
1225 break;
1226 case Builtin::BI__builtin_annotation:
1227 if (SemaBuiltinAnnotation(*this, TheCall))
1228 return ExprError();
1229 break;
1230 case Builtin::BI__builtin_addressof:
1231 if (SemaBuiltinAddressof(*this, TheCall))
1232 return ExprError();
1233 break;
1234 case Builtin::BI__builtin_add_overflow:
1235 case Builtin::BI__builtin_sub_overflow:
1236 case Builtin::BI__builtin_mul_overflow:
1237 if (SemaBuiltinOverflow(*this, TheCall))
1238 return ExprError();
1239 break;
1240 case Builtin::BI__builtin_operator_new:
1241 case Builtin::BI__builtin_operator_delete: {
1242 bool IsDelete = BuiltinID == Builtin::BI__builtin_operator_delete;
1243 ExprResult Res =
1244 SemaBuiltinOperatorNewDeleteOverloaded(TheCallResult, IsDelete);
1245 if (Res.isInvalid())
1246 CorrectDelayedTyposInExpr(TheCallResult.get());
1247 return Res;
1248 }
1249 case Builtin::BI__builtin_dump_struct: {
1250 // We first want to ensure we are called with 2 arguments
1251 if (checkArgCount(*this, TheCall, 2))
1252 return ExprError();
1253 // Ensure that the first argument is of type 'struct XX *'
1254 const Expr *PtrArg = TheCall->getArg(0)->IgnoreParenImpCasts();
1255 const QualType PtrArgType = PtrArg->getType();
1256 if (!PtrArgType->isPointerType() ||
1257 !PtrArgType->getPointeeType()->isRecordType()) {
1258 Diag(PtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
1259 << PtrArgType << "structure pointer" << 1 << 0 << 3 << 1 << PtrArgType
1260 << "structure pointer";
1261 return ExprError();
1262 }
1263
1264 // Ensure that the second argument is of type 'FunctionType'
1265 const Expr *FnPtrArg = TheCall->getArg(1)->IgnoreImpCasts();
1266 const QualType FnPtrArgType = FnPtrArg->getType();
1267 if (!FnPtrArgType->isPointerType()) {
1268 Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
1269 << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3 << 2
1270 << FnPtrArgType << "'int (*)(const char *, ...)'";
1271 return ExprError();
1272 }
1273
1274 const auto *FuncType =
1275 FnPtrArgType->getPointeeType()->getAs<FunctionType>();
1276
1277 if (!FuncType) {
1278 Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
1279 << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3 << 2
1280 << FnPtrArgType << "'int (*)(const char *, ...)'";
1281 return ExprError();
1282 }
1283
1284 if (const auto *FT = dyn_cast<FunctionProtoType>(FuncType)) {
1285 if (!FT->getNumParams()) {
1286 Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
1287 << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3
1288 << 2 << FnPtrArgType << "'int (*)(const char *, ...)'";
1289 return ExprError();
1290 }
1291 QualType PT = FT->getParamType(0);
1292 if (!FT->isVariadic() || FT->getReturnType() != Context.IntTy ||
1293 !PT->isPointerType() || !PT->getPointeeType()->isCharType() ||
1294 !PT->getPointeeType().isConstQualified()) {
1295 Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
1296 << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3
1297 << 2 << FnPtrArgType << "'int (*)(const char *, ...)'";
1298 return ExprError();
1299 }
1300 }
1301
1302 TheCall->setType(Context.IntTy);
1303 break;
1304 }
1305
1306 // check secure string manipulation functions where overflows
1307 // are detectable at compile time
1308 case Builtin::BI__builtin___memcpy_chk:
1309 SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3, "memcpy");
1310 break;
1311 case Builtin::BI__builtin___memmove_chk:
1312 SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3, "memmove");
1313 break;
1314 case Builtin::BI__builtin___memset_chk:
1315 SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3, "memset");
1316 break;
1317 case Builtin::BI__builtin___strlcat_chk:
1318 SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3, "strlcat");
1319 break;
1320 case Builtin::BI__builtin___strlcpy_chk:
1321 SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3, "strlcpy");
1322 break;
1323 case Builtin::BI__builtin___strncat_chk:
1324 SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3, "strncat");
1325 break;
1326 case Builtin::BI__builtin___strncpy_chk:
1327 SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3, "strncpy");
1328 break;
1329 case Builtin::BI__builtin___stpncpy_chk:
1330 SemaBuiltinMemChkCall(*this, FDecl, TheCall, 2, 3, "stpncpy");
1331 break;
1332 case Builtin::BI__builtin___memccpy_chk:
1333 SemaBuiltinMemChkCall(*this, FDecl, TheCall, 3, 4, "memccpy");
1334 break;
1335 case Builtin::BI__builtin___snprintf_chk:
1336 SemaBuiltinMemChkCall(*this, FDecl, TheCall, 1, 3, "snprintf");
1337 break;
1338 case Builtin::BI__builtin___vsnprintf_chk:
1339 SemaBuiltinMemChkCall(*this, FDecl, TheCall, 1, 3, "vsnprintf");
1340 break;
1341 case Builtin::BI__builtin_call_with_static_chain:
1342 if (SemaBuiltinCallWithStaticChain(*this, TheCall))
1343 return ExprError();
1344 break;
1345 case Builtin::BI__exception_code:
1346 case Builtin::BI_exception_code:
1347 if (SemaBuiltinSEHScopeCheck(*this, TheCall, Scope::SEHExceptScope,
1348 diag::err_seh___except_block))
1349 return ExprError();
1350 break;
1351 case Builtin::BI__exception_info:
1352 case Builtin::BI_exception_info:
1353 if (SemaBuiltinSEHScopeCheck(*this, TheCall, Scope::SEHFilterScope,
1354 diag::err_seh___except_filter))
1355 return ExprError();
1356 break;
1357 case Builtin::BI__GetExceptionInfo:
1358 if (checkArgCount(*this, TheCall, 1))
1359 return ExprError();
1360
1361 if (CheckCXXThrowOperand(
1362 TheCall->getBeginLoc(),
1363 Context.getExceptionObjectType(FDecl->getParamDecl(0)->getType()),
1364 TheCall))
1365 return ExprError();
1366
1367 TheCall->setType(Context.VoidPtrTy);
1368 break;
1369 // OpenCL v2.0, s6.13.16 - Pipe functions
1370 case Builtin::BIread_pipe:
1371 case Builtin::BIwrite_pipe:
1372 // Since those two functions are declared with var args, we need a semantic
1373 // check for the argument.
1374 if (SemaBuiltinRWPipe(*this, TheCall))
1375 return ExprError();
1376 break;
1377 case Builtin::BIreserve_read_pipe:
1378 case Builtin::BIreserve_write_pipe:
1379 case Builtin::BIwork_group_reserve_read_pipe:
1380 case Builtin::BIwork_group_reserve_write_pipe:
1381 if (SemaBuiltinReserveRWPipe(*this, TheCall))
1382 return ExprError();
1383 break;
1384 case Builtin::BIsub_group_reserve_read_pipe:
1385 case Builtin::BIsub_group_reserve_write_pipe:
1386 if (checkOpenCLSubgroupExt(*this, TheCall) ||
1387 SemaBuiltinReserveRWPipe(*this, TheCall))
1388 return ExprError();
1389 break;
1390 case Builtin::BIcommit_read_pipe:
1391 case Builtin::BIcommit_write_pipe:
1392 case Builtin::BIwork_group_commit_read_pipe:
1393 case Builtin::BIwork_group_commit_write_pipe:
1394 if (SemaBuiltinCommitRWPipe(*this, TheCall))
1395 return ExprError();
1396 break;
1397 case Builtin::BIsub_group_commit_read_pipe:
1398 case Builtin::BIsub_group_commit_write_pipe:
1399 if (checkOpenCLSubgroupExt(*this, TheCall) ||
1400 SemaBuiltinCommitRWPipe(*this, TheCall))
1401 return ExprError();
1402 break;
1403 case Builtin::BIget_pipe_num_packets:
1404 case Builtin::BIget_pipe_max_packets:
1405 if (SemaBuiltinPipePackets(*this, TheCall))
1406 return ExprError();
1407 break;
1408 case Builtin::BIto_global:
1409 case Builtin::BIto_local:
1410 case Builtin::BIto_private:
1411 if (SemaOpenCLBuiltinToAddr(*this, BuiltinID, TheCall))
1412 return ExprError();
1413 break;
1414 // OpenCL v2.0, s6.13.17 - Enqueue kernel functions.
1415 case Builtin::BIenqueue_kernel:
1416 if (SemaOpenCLBuiltinEnqueueKernel(*this, TheCall))
1417 return ExprError();
1418 break;
1419 case Builtin::BIget_kernel_work_group_size:
1420 case Builtin::BIget_kernel_preferred_work_group_size_multiple:
1421 if (SemaOpenCLBuiltinKernelWorkGroupSize(*this, TheCall))
1422 return ExprError();
1423 break;
1424 case Builtin::BIget_kernel_max_sub_group_size_for_ndrange:
1425 case Builtin::BIget_kernel_sub_group_count_for_ndrange:
1426 if (SemaOpenCLBuiltinNDRangeAndBlock(*this, TheCall))
1427 return ExprError();
1428 break;
1429 case Builtin::BI__builtin_os_log_format:
1430 case Builtin::BI__builtin_os_log_format_buffer_size:
1431 if (SemaBuiltinOSLogFormat(TheCall))
1432 return ExprError();
1433 break;
1434 }
1435
1436 // Since the target specific builtins for each arch overlap, only check those
1437 // of the arch we are compiling for.
1438 if (Context.BuiltinInfo.isTSBuiltin(BuiltinID)) {
1439 switch (Context.getTargetInfo().getTriple().getArch()) {
1440 case llvm::Triple::arm:
1441 case llvm::Triple::armeb:
1442 case llvm::Triple::thumb:
1443 case llvm::Triple::thumbeb:
1444 if (CheckARMBuiltinFunctionCall(BuiltinID, TheCall))
1445 return ExprError();
1446 break;
1447 case llvm::Triple::aarch64:
1448 case llvm::Triple::aarch64_be:
1449 if (CheckAArch64BuiltinFunctionCall(BuiltinID, TheCall))
1450 return ExprError();
1451 break;
1452 case llvm::Triple::hexagon:
1453 if (CheckHexagonBuiltinFunctionCall(BuiltinID, TheCall))
1454 return ExprError();
1455 break;
1456 case llvm::Triple::mips:
1457 case llvm::Triple::mipsel:
1458 case llvm::Triple::mips64:
1459 case llvm::Triple::mips64el:
1460 if (CheckMipsBuiltinFunctionCall(BuiltinID, TheCall))
1461 return ExprError();
1462 break;
1463 case llvm::Triple::systemz:
1464 if (CheckSystemZBuiltinFunctionCall(BuiltinID, TheCall))
1465 return ExprError();
1466 break;
1467 case llvm::Triple::x86:
1468 case llvm::Triple::x86_64:
1469 if (CheckX86BuiltinFunctionCall(BuiltinID, TheCall))
1470 return ExprError();
1471 break;
1472 case llvm::Triple::ppc:
1473 case llvm::Triple::ppc64:
1474 case llvm::Triple::ppc64le:
1475 if (CheckPPCBuiltinFunctionCall(BuiltinID, TheCall))
1476 return ExprError();
1477 break;
1478 default:
1479 break;
1480 }
1481 }
1482
1483 return TheCallResult;
1484}
1485
1486// Get the valid immediate range for the specified NEON type code.
1487static unsigned RFT(unsigned t, bool shift = false, bool ForceQuad = false) {
1488 NeonTypeFlags Type(t);
1489 int IsQuad = ForceQuad ? true : Type.isQuad();
1490 switch (Type.getEltType()) {
1491 case NeonTypeFlags::Int8:
1492 case NeonTypeFlags::Poly8:
1493 return shift ? 7 : (8 << IsQuad) - 1;
1494 case NeonTypeFlags::Int16:
1495 case NeonTypeFlags::Poly16:
1496 return shift ? 15 : (4 << IsQuad) - 1;
1497 case NeonTypeFlags::Int32:
1498 return shift ? 31 : (2 << IsQuad) - 1;
1499 case NeonTypeFlags::Int64:
1500 case NeonTypeFlags::Poly64:
1501 return shift ? 63 : (1 << IsQuad) - 1;
1502 case NeonTypeFlags::Poly128:
1503 return shift ? 127 : (1 << IsQuad) - 1;
1504 case NeonTypeFlags::Float16:
1505 assert(!shift && "cannot shift float types!");
1506 return (4 << IsQuad) - 1;
1507 case NeonTypeFlags::Float32:
1508 assert(!shift && "cannot shift float types!");
1509 return (2 << IsQuad) - 1;
1510 case NeonTypeFlags::Float64:
1511 assert(!shift && "cannot shift float types!");
1512 return (1 << IsQuad) - 1;
1513 }
1514 llvm_unreachable("Invalid NeonTypeFlag!");
1515}
1516
1517/// getNeonEltType - Return the QualType corresponding to the elements of
1518/// the vector type specified by the NeonTypeFlags. This is used to check
1519/// the pointer arguments for Neon load/store intrinsics.
1520static QualType getNeonEltType(NeonTypeFlags Flags, ASTContext &Context,
1521 bool IsPolyUnsigned, bool IsInt64Long) {
1522 switch (Flags.getEltType()) {
1523 case NeonTypeFlags::Int8:
1524 return Flags.isUnsigned() ? Context.UnsignedCharTy : Context.SignedCharTy;
1525 case NeonTypeFlags::Int16:
1526 return Flags.isUnsigned() ? Context.UnsignedShortTy : Context.ShortTy;
1527 case NeonTypeFlags::Int32:
1528 return Flags.isUnsigned() ? Context.UnsignedIntTy : Context.IntTy;
1529 case NeonTypeFlags::Int64:
1530 if (IsInt64Long)
1531 return Flags.isUnsigned() ? Context.UnsignedLongTy : Context.LongTy;
1532 else
1533 return Flags.isUnsigned() ? Context.UnsignedLongLongTy
1534 : Context.LongLongTy;
1535 case NeonTypeFlags::Poly8:
1536 return IsPolyUnsigned ? Context.UnsignedCharTy : Context.SignedCharTy;
1537 case NeonTypeFlags::Poly16:
1538 return IsPolyUnsigned ? Context.UnsignedShortTy : Context.ShortTy;
1539 case NeonTypeFlags::Poly64:
1540 if (IsInt64Long)
1541 return Context.UnsignedLongTy;
1542 else
1543 return Context.UnsignedLongLongTy;
1544 case NeonTypeFlags::Poly128:
1545 break;
1546 case NeonTypeFlags::Float16:
1547 return Context.HalfTy;
1548 case NeonTypeFlags::Float32:
1549 return Context.FloatTy;
1550 case NeonTypeFlags::Float64:
1551 return Context.DoubleTy;
1552 }
1553 llvm_unreachable("Invalid NeonTypeFlag!");
1554}
1555
1556bool Sema::CheckNeonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
1557 llvm::APSInt Result;
1558 uint64_t mask = 0;
1559 unsigned TV = 0;
1560 int PtrArgNum = -1;
1561 bool HasConstPtr = false;
1562 switch (BuiltinID) {
1563#define GET_NEON_OVERLOAD_CHECK
1564#include "clang/Basic/arm_neon.inc"
1565#include "clang/Basic/arm_fp16.inc"
1566#undef GET_NEON_OVERLOAD_CHECK
1567 }
1568
1569 // For NEON intrinsics which are overloaded on vector element type, validate
1570 // the immediate which specifies which variant to emit.
1571 unsigned ImmArg = TheCall->getNumArgs()-1;
1572 if (mask) {
1573 if (SemaBuiltinConstantArg(TheCall, ImmArg, Result))
1574 return true;
1575
1576 TV = Result.getLimitedValue(64);
1577 if ((TV > 63) || (mask & (1ULL << TV)) == 0)
1578 return Diag(TheCall->getBeginLoc(), diag::err_invalid_neon_type_code)
1579 << TheCall->getArg(ImmArg)->getSourceRange();
1580 }
1581
1582 if (PtrArgNum >= 0) {
1583 // Check that pointer arguments have the specified type.
1584 Expr *Arg = TheCall->getArg(PtrArgNum);
1585 if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Arg))
1586 Arg = ICE->getSubExpr();
1587 ExprResult RHS = DefaultFunctionArrayLvalueConversion(Arg);
1588 QualType RHSTy = RHS.get()->getType();
1589
1590 llvm::Triple::ArchType Arch = Context.getTargetInfo().getTriple().getArch();
1591 bool IsPolyUnsigned = Arch == llvm::Triple::aarch64 ||
1592 Arch == llvm::Triple::aarch64_be;
1593 bool IsInt64Long =
1594 Context.getTargetInfo().getInt64Type() == TargetInfo::SignedLong;
1595 QualType EltTy =
1596 getNeonEltType(NeonTypeFlags(TV), Context, IsPolyUnsigned, IsInt64Long);
1597 if (HasConstPtr)
1598 EltTy = EltTy.withConst();
1599 QualType LHSTy = Context.getPointerType(EltTy);
1600 AssignConvertType ConvTy;
1601 ConvTy = CheckSingleAssignmentConstraints(LHSTy, RHS);
1602 if (RHS.isInvalid())
1603 return true;
1604 if (DiagnoseAssignmentResult(ConvTy, Arg->getBeginLoc(), LHSTy, RHSTy,
1605 RHS.get(), AA_Assigning))
1606 return true;
1607 }
1608
1609 // For NEON intrinsics which take an immediate value as part of the
1610 // instruction, range check them here.
1611 unsigned i = 0, l = 0, u = 0;
1612 switch (BuiltinID) {
1613 default:
1614 return false;
1615 #define GET_NEON_IMMEDIATE_CHECK
1616 #include "clang/Basic/arm_neon.inc"
1617 #include "clang/Basic/arm_fp16.inc"
1618 #undef GET_NEON_IMMEDIATE_CHECK
1619 }
1620
1621 return SemaBuiltinConstantArgRange(TheCall, i, l, u + l);
1622}
1623
1624bool Sema::CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
1625 unsigned MaxWidth) {
1626 assert((BuiltinID == ARM::BI__builtin_arm_ldrex ||
1627 BuiltinID == ARM::BI__builtin_arm_ldaex ||
1628 BuiltinID == ARM::BI__builtin_arm_strex ||
1629 BuiltinID == ARM::BI__builtin_arm_stlex ||
1630 BuiltinID == AArch64::BI__builtin_arm_ldrex ||
1631 BuiltinID == AArch64::BI__builtin_arm_ldaex ||
1632 BuiltinID == AArch64::BI__builtin_arm_strex ||
1633 BuiltinID == AArch64::BI__builtin_arm_stlex) &&
1634 "unexpected ARM builtin");
1635 bool IsLdrex = BuiltinID == ARM::BI__builtin_arm_ldrex ||
1636 BuiltinID == ARM::BI__builtin_arm_ldaex ||
1637 BuiltinID == AArch64::BI__builtin_arm_ldrex ||
1638 BuiltinID == AArch64::BI__builtin_arm_ldaex;
1639
1640 DeclRefExpr *DRE =cast<DeclRefExpr>(TheCall->getCallee()->IgnoreParenCasts());
1641
1642 // Ensure that we have the proper number of arguments.
1643 if (checkArgCount(*this, TheCall, IsLdrex ? 1 : 2))
1644 return true;
1645
1646 // Inspect the pointer argument of the atomic builtin. This should always be
1647 // a pointer type, whose element is an integral scalar or pointer type.
1648 // Because it is a pointer type, we don't have to worry about any implicit
1649 // casts here.
1650 Expr *PointerArg = TheCall->getArg(IsLdrex ? 0 : 1);
1651 ExprResult PointerArgRes = DefaultFunctionArrayLvalueConversion(PointerArg);
1652 if (PointerArgRes.isInvalid())
1653 return true;
1654 PointerArg = PointerArgRes.get();
1655
1656 const PointerType *pointerType = PointerArg->getType()->getAs<PointerType>();
1657 if (!pointerType) {
1658 Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer)
1659 << PointerArg->getType() << PointerArg->getSourceRange();
1660 return true;
1661 }
1662
1663 // ldrex takes a "const volatile T*" and strex takes a "volatile T*". Our next
1664 // task is to insert the appropriate casts into the AST. First work out just
1665 // what the appropriate type is.
1666 QualType ValType = pointerType->getPointeeType();
1667 QualType AddrType = ValType.getUnqualifiedType().withVolatile();
1668 if (IsLdrex)
1669 AddrType.addConst();
1670
1671 // Issue a warning if the cast is dodgy.
1672 CastKind CastNeeded = CK_NoOp;
1673 if (!AddrType.isAtLeastAsQualifiedAs(ValType)) {
1674 CastNeeded = CK_BitCast;
1675 Diag(DRE->getBeginLoc(), diag::ext_typecheck_convert_discards_qualifiers)
1676 << PointerArg->getType() << Context.getPointerType(AddrType)
1677 << AA_Passing << PointerArg->getSourceRange();
1678 }
1679
1680 // Finally, do the cast and replace the argument with the corrected version.
1681 AddrType = Context.getPointerType(AddrType);
1682 PointerArgRes = ImpCastExprToType(PointerArg, AddrType, CastNeeded);
1683 if (PointerArgRes.isInvalid())
1684 return true;
1685 PointerArg = PointerArgRes.get();
1686
1687 TheCall->setArg(IsLdrex ? 0 : 1, PointerArg);
1688
1689 // In general, we allow ints, floats and pointers to be loaded and stored.
1690 if (!ValType->isIntegerType() && !ValType->isAnyPointerType() &&
1691 !ValType->isBlockPointerType() && !ValType->isFloatingType()) {
1692 Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intfltptr)
1693 << PointerArg->getType() << PointerArg->getSourceRange();
1694 return true;
1695 }
1696
1697 // But ARM doesn't have instructions to deal with 128-bit versions.
1698 if (Context.getTypeSize(ValType) > MaxWidth) {
1699 assert(MaxWidth == 64 && "Diagnostic unexpectedly inaccurate");
1700 Diag(DRE->getBeginLoc(), diag::err_atomic_exclusive_builtin_pointer_size)
1701 << PointerArg->getType() << PointerArg->getSourceRange();
1702 return true;
1703 }
1704
1705 switch (ValType.getObjCLifetime()) {
1706 case Qualifiers::OCL_None:
1707 case Qualifiers::OCL_ExplicitNone:
1708 // okay
1709 break;
1710
1711 case Qualifiers::OCL_Weak:
1712 case Qualifiers::OCL_Strong:
1713 case Qualifiers::OCL_Autoreleasing:
1714 Diag(DRE->getBeginLoc(), diag::err_arc_atomic_ownership)
1715 << ValType << PointerArg->getSourceRange();
1716 return true;
1717 }
1718
1719 if (IsLdrex) {
1720 TheCall->setType(ValType);
1721 return false;
1722 }
1723
1724 // Initialize the argument to be stored.
1725 ExprResult ValArg = TheCall->getArg(0);
1726 InitializedEntity Entity = InitializedEntity::InitializeParameter(
1727 Context, ValType, /*consume*/ false);
1728 ValArg = PerformCopyInitialization(Entity, SourceLocation(), ValArg);
1729 if (ValArg.isInvalid())
1730 return true;
1731 TheCall->setArg(0, ValArg.get());
1732
1733 // __builtin_arm_strex always returns an int. It's marked as such in the .def,
1734 // but the custom checker bypasses all default analysis.
1735 TheCall->setType(Context.IntTy);
1736 return false;
1737}
1738
1739bool Sema::CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
1740 if (BuiltinID == ARM::BI__builtin_arm_ldrex ||
1741 BuiltinID == ARM::BI__builtin_arm_ldaex ||
1742 BuiltinID == ARM::BI__builtin_arm_strex ||
1743 BuiltinID == ARM::BI__builtin_arm_stlex) {
1744 return CheckARMBuiltinExclusiveCall(BuiltinID, TheCall, 64);
1745 }
1746
1747 if (BuiltinID == ARM::BI__builtin_arm_prefetch) {
1748 return SemaBuiltinConstantArgRange(TheCall, 1, 0, 1) ||
1749 SemaBuiltinConstantArgRange(TheCall, 2, 0, 1);
1750 }
1751
1752 if (BuiltinID == ARM::BI__builtin_arm_rsr64 ||
1753 BuiltinID == ARM::BI__builtin_arm_wsr64)
1754 return SemaBuiltinARMSpecialReg(BuiltinID, TheCall, 0, 3, false);
1755
1756 if (BuiltinID == ARM::BI__builtin_arm_rsr ||
1757 BuiltinID == ARM::BI__builtin_arm_rsrp ||
1758 BuiltinID == ARM::BI__builtin_arm_wsr ||
1759 BuiltinID == ARM::BI__builtin_arm_wsrp)
1760 return SemaBuiltinARMSpecialReg(BuiltinID, TheCall, 0, 5, true);
1761
1762 if (CheckNeonBuiltinFunctionCall(BuiltinID, TheCall))
1763 return true;
1764
1765 // For intrinsics which take an immediate value as part of the instruction,
1766 // range check them here.
1767 // FIXME: VFP Intrinsics should error if VFP not present.
1768 switch (BuiltinID) {
1769 default: return false;
1770 case ARM::BI__builtin_arm_ssat:
1771 return SemaBuiltinConstantArgRange(TheCall, 1, 1, 32);
1772 case ARM::BI__builtin_arm_usat:
1773 return SemaBuiltinConstantArgRange(TheCall, 1, 0, 31);
1774 case ARM::BI__builtin_arm_ssat16:
1775 return SemaBuiltinConstantArgRange(TheCall, 1, 1, 16);
1776 case ARM::BI__builtin_arm_usat16:
1777 return SemaBuiltinConstantArgRange(TheCall, 1, 0, 15);
1778 case ARM::BI__builtin_arm_vcvtr_f:
1779 case ARM::BI__builtin_arm_vcvtr_d:
1780 return SemaBuiltinConstantArgRange(TheCall, 1, 0, 1);
1781 case ARM::BI__builtin_arm_dmb:
1782 case ARM::BI__builtin_arm_dsb:
1783 case ARM::BI__builtin_arm_isb:
1784 case ARM::BI__builtin_arm_dbg:
1785 return SemaBuiltinConstantArgRange(TheCall, 0, 0, 15);
1786 }
1787}
1788
1789bool Sema::CheckAArch64BuiltinFunctionCall(unsigned BuiltinID,
1790 CallExpr *TheCall) {
1791 if (BuiltinID == AArch64::BI__builtin_arm_ldrex ||
1792 BuiltinID == AArch64::BI__builtin_arm_ldaex ||
1793 BuiltinID == AArch64::BI__builtin_arm_strex ||
1794 BuiltinID == AArch64::BI__builtin_arm_stlex) {
1795 return CheckARMBuiltinExclusiveCall(BuiltinID, TheCall, 128);
1796 }
1797
1798 if (BuiltinID == AArch64::BI__builtin_arm_prefetch) {
1799 return SemaBuiltinConstantArgRange(TheCall, 1, 0, 1) ||
1800 SemaBuiltinConstantArgRange(TheCall, 2, 0, 2) ||
1801 SemaBuiltinConstantArgRange(TheCall, 3, 0, 1) ||
1802 SemaBuiltinConstantArgRange(TheCall, 4, 0, 1);
1803 }
1804
1805 if (BuiltinID == AArch64::BI__builtin_arm_rsr64 ||
1806 BuiltinID == AArch64::BI__builtin_arm_wsr64)
1807 return SemaBuiltinARMSpecialReg(BuiltinID, TheCall, 0, 5, true);
1808
1809 if (BuiltinID == AArch64::BI__builtin_arm_rsr ||
1810 BuiltinID == AArch64::BI__builtin_arm_rsrp ||
1811 BuiltinID == AArch64::BI__builtin_arm_wsr ||
1812 BuiltinID == AArch64::BI__builtin_arm_wsrp)
1813 return SemaBuiltinARMSpecialReg(BuiltinID, TheCall, 0, 5, true);
1814
1815 // Only check the valid encoding range. Any constant in this range would be
1816 // converted to a register of the form S1_2_C3_C4_5. Let the hardware throw
1817 // an exception for incorrect registers. This matches MSVC behavior.
1818 if (BuiltinID == AArch64::BI_ReadStatusReg ||
1819 BuiltinID == AArch64::BI_WriteStatusReg)
1820 return SemaBuiltinConstantArgRange(TheCall, 0, 0, 0x7fff);
1821
1822 if (BuiltinID == AArch64::BI__getReg)
1823 return SemaBuiltinConstantArgRange(TheCall, 0, 0, 31);
1824
1825 if (CheckNeonBuiltinFunctionCall(BuiltinID, TheCall))
1826 return true;
1827
1828 // For intrinsics which take an immediate value as part of the instruction,
1829 // range check them here.
1830 unsigned i = 0, l = 0, u = 0;
1831 switch (BuiltinID) {
1832 default: return false;
1833 case AArch64::BI__builtin_arm_dmb:
1834 case AArch64::BI__builtin_arm_dsb:
1835 case AArch64::BI__builtin_arm_isb: l = 0; u = 15; break;
1836 }
1837
1838 return SemaBuiltinConstantArgRange(TheCall, i, l, u + l);
1839}
1840
1841bool Sema::CheckHexagonBuiltinCpu(unsigned BuiltinID, CallExpr *TheCall) {
1842 struct BuiltinAndString {
1843 unsigned BuiltinID;
1844 const char *Str;
1845 };
1846
1847 static BuiltinAndString ValidCPU[] = {
1848 { Hexagon::BI__builtin_HEXAGON_A6_vcmpbeq_notany, "v65,v66" },
1849 { Hexagon::BI__builtin_HEXAGON_A6_vminub_RdP, "v62,v65,v66" },
1850 { Hexagon::BI__builtin_HEXAGON_F2_dfadd, "v66" },
1851 { Hexagon::BI__builtin_HEXAGON_F2_dfsub, "v66" },
1852 { Hexagon::BI__builtin_HEXAGON_M2_mnaci, "v66" },
1853 { Hexagon::BI__builtin_HEXAGON_M6_vabsdiffb, "v62,v65,v66" },
1854 { Hexagon::BI__builtin_HEXAGON_M6_vabsdiffub, "v62,v65,v66" },
1855 { Hexagon::BI__builtin_HEXAGON_S2_mask, "v66" },
1856 { Hexagon::BI__builtin_HEXAGON_S6_rol_i_p_acc, "v60,v62,v65,v66" },
1857 { Hexagon::BI__builtin_HEXAGON_S6_rol_i_p_and, "v60,v62,v65,v66" },
1858 { Hexagon::BI__builtin_HEXAGON_S6_rol_i_p_nac, "v60,v62,v65,v66" },
1859 { Hexagon::BI__builtin_HEXAGON_S6_rol_i_p_or, "v60,v62,v65,v66" },
1860 { Hexagon::BI__builtin_HEXAGON_S6_rol_i_p, "v60,v62,v65,v66" },
1861 { Hexagon::BI__builtin_HEXAGON_S6_rol_i_p_xacc, "v60,v62,v65,v66" },
1862 { Hexagon::BI__builtin_HEXAGON_S6_rol_i_r_acc, "v60,v62,v65,v66" },
1863 { Hexagon::BI__builtin_HEXAGON_S6_rol_i_r_and, "v60,v62,v65,v66" },
1864 { Hexagon::BI__builtin_HEXAGON_S6_rol_i_r_nac, "v60,v62,v65,v66" },
1865 { Hexagon::BI__builtin_HEXAGON_S6_rol_i_r_or, "v60,v62,v65,v66" },
1866 { Hexagon::BI__builtin_HEXAGON_S6_rol_i_r, "v60,v62,v65,v66" },
1867 { Hexagon::BI__builtin_HEXAGON_S6_rol_i_r_xacc, "v60,v62,v65,v66" },
1868 { Hexagon::BI__builtin_HEXAGON_S6_vsplatrbp, "v62,v65,v66" },
1869 { Hexagon::BI__builtin_HEXAGON_S6_vtrunehb_ppp, "v62,v65,v66" },
1870 { Hexagon::BI__builtin_HEXAGON_S6_vtrunohb_ppp, "v62,v65,v66" },
1871 };
1872
1873 static BuiltinAndString ValidHVX[] = {
1874 { Hexagon::BI__builtin_HEXAGON_V6_hi, "v60,v62,v65,v66" },
1875 { Hexagon::BI__builtin_HEXAGON_V6_hi_128B, "v60,v62,v65,v66" },
1876 { Hexagon::BI__builtin_HEXAGON_V6_lo, "v60,v62,v65,v66" },
1877 { Hexagon::BI__builtin_HEXAGON_V6_lo_128B, "v60,v62,v65,v66" },
1878 { Hexagon::BI__builtin_HEXAGON_V6_extractw, "v60,v62,v65,v66" },
1879 { Hexagon::BI__builtin_HEXAGON_V6_extractw_128B, "v60,v62,v65,v66" },
1880 { Hexagon::BI__builtin_HEXAGON_V6_lvsplatb, "v62,v65,v66" },
1881 { Hexagon::BI__builtin_HEXAGON_V6_lvsplatb_128B, "v62,v65,v66" },
1882 { Hexagon::BI__builtin_HEXAGON_V6_lvsplath, "v62,v65,v66" },
1883 { Hexagon::BI__builtin_HEXAGON_V6_lvsplath_128B, "v62,v65,v66" },
1884 { Hexagon::BI__builtin_HEXAGON_V6_lvsplatw, "v60,v62,v65,v66" },
1885 { Hexagon::BI__builtin_HEXAGON_V6_lvsplatw_128B, "v60,v62,v65,v66" },
1886 { Hexagon::BI__builtin_HEXAGON_V6_pred_and, "v60,v62,v65,v66" },
1887 { Hexagon::BI__builtin_HEXAGON_V6_pred_and_128B, "v60,v62,v65,v66" },
1888 { Hexagon::BI__builtin_HEXAGON_V6_pred_and_n, "v60,v62,v65,v66" },
1889 { Hexagon::BI__builtin_HEXAGON_V6_pred_and_n_128B, "v60,v62,v65,v66" },
1890 { Hexagon::BI__builtin_HEXAGON_V6_pred_not, "v60,v62,v65,v66" },
1891 { Hexagon::BI__builtin_HEXAGON_V6_pred_not_128B, "v60,v62,v65,v66" },
1892 { Hexagon::BI__builtin_HEXAGON_V6_pred_or, "v60,v62,v65,v66" },
1893 { Hexagon::BI__builtin_HEXAGON_V6_pred_or_128B, "v60,v62,v65,v66" },
1894 { Hexagon::BI__builtin_HEXAGON_V6_pred_or_n, "v60,v62,v65,v66" },
1895 { Hexagon::BI__builtin_HEXAGON_V6_pred_or_n_128B, "v60,v62,v65,v66" },
1896 { Hexagon::BI__builtin_HEXAGON_V6_pred_scalar2, "v60,v62,v65,v66" },
1897 { Hexagon::BI__builtin_HEXAGON_V6_pred_scalar2_128B, "v60,v62,v65,v66" },
1898 { Hexagon::BI__builtin_HEXAGON_V6_pred_scalar2v2, "v62,v65,v66" },
1899 { Hexagon::BI__builtin_HEXAGON_V6_pred_scalar2v2_128B, "v62,v65,v66" },
1900 { Hexagon::BI__builtin_HEXAGON_V6_pred_xor, "v60,v62,v65,v66" },
1901 { Hexagon::BI__builtin_HEXAGON_V6_pred_xor_128B, "v60,v62,v65,v66" },
1902 { Hexagon::BI__builtin_HEXAGON_V6_shuffeqh, "v62,v65,v66" },
1903 { Hexagon::BI__builtin_HEXAGON_V6_shuffeqh_128B, "v62,v65,v66" },
1904 { Hexagon::BI__builtin_HEXAGON_V6_shuffeqw, "v62,v65,v66" },
1905 { Hexagon::BI__builtin_HEXAGON_V6_shuffeqw_128B, "v62,v65,v66" },
1906 { Hexagon::BI__builtin_HEXAGON_V6_vabsb, "v65,v66" },
1907 { Hexagon::BI__builtin_HEXAGON_V6_vabsb_128B, "v65,v66" },
1908 { Hexagon::BI__builtin_HEXAGON_V6_vabsb_sat, "v65,v66" },
1909 { Hexagon::BI__builtin_HEXAGON_V6_vabsb_sat_128B, "v65,v66" },
1910 { Hexagon::BI__builtin_HEXAGON_V6_vabsdiffh, "v60,v62,v65,v66" },
1911 { Hexagon::BI__builtin_HEXAGON_V6_vabsdiffh_128B, "v60,v62,v65,v66" },
1912 { Hexagon::BI__builtin_HEXAGON_V6_vabsdiffub, "v60,v62,v65,v66" },
1913 { Hexagon::BI__builtin_HEXAGON_V6_vabsdiffub_128B, "v60,v62,v65,v66" },
1914 { Hexagon::BI__builtin_HEXAGON_V6_vabsdiffuh, "v60,v62,v65,v66" },
1915 { Hexagon::BI__builtin_HEXAGON_V6_vabsdiffuh_128B, "v60,v62,v65,v66" },
1916 { Hexagon::BI__builtin_HEXAGON_V6_vabsdiffw, "v60,v62,v65,v66" },
1917 { Hexagon::BI__builtin_HEXAGON_V6_vabsdiffw_128B, "v60,v62,v65,v66" },
1918 { Hexagon::BI__builtin_HEXAGON_V6_vabsh, "v60,v62,v65,v66" },
1919 { Hexagon::BI__builtin_HEXAGON_V6_vabsh_128B, "v60,v62,v65,v66" },
1920 { Hexagon::BI__builtin_HEXAGON_V6_vabsh_sat, "v60,v62,v65,v66" },
1921 { Hexagon::BI__builtin_HEXAGON_V6_vabsh_sat_128B, "v60,v62,v65,v66" },
1922 { Hexagon::BI__builtin_HEXAGON_V6_vabsw, "v60,v62,v65,v66" },
1923 { Hexagon::BI__builtin_HEXAGON_V6_vabsw_128B, "v60,v62,v65,v66" },
1924 { Hexagon::BI__builtin_HEXAGON_V6_vabsw_sat, "v60,v62,v65,v66" },
1925 { Hexagon::BI__builtin_HEXAGON_V6_vabsw_sat_128B, "v60,v62,v65,v66" },
1926 { Hexagon::BI__builtin_HEXAGON_V6_vaddb, "v60,v62,v65,v66" },
1927 { Hexagon::BI__builtin_HEXAGON_V6_vaddb_128B, "v60,v62,v65,v66" },
1928 { Hexagon::BI__builtin_HEXAGON_V6_vaddb_dv, "v60,v62,v65,v66" },
1929 { Hexagon::BI__builtin_HEXAGON_V6_vaddb_dv_128B, "v60,v62,v65,v66" },
1930 { Hexagon::BI__builtin_HEXAGON_V6_vaddbsat, "v62,v65,v66" },
1931 { Hexagon::BI__builtin_HEXAGON_V6_vaddbsat_128B, "v62,v65,v66" },
1932 { Hexagon::BI__builtin_HEXAGON_V6_vaddbsat_dv, "v62,v65,v66" },
1933 { Hexagon::BI__builtin_HEXAGON_V6_vaddbsat_dv_128B, "v62,v65,v66" },
1934 { Hexagon::BI__builtin_HEXAGON_V6_vaddcarry, "v62,v65,v66" },
1935 { Hexagon::BI__builtin_HEXAGON_V6_vaddcarry_128B, "v62,v65,v66" },
1936 { Hexagon::BI__builtin_HEXAGON_V6_vaddcarrysat, "v66" },
1937 { Hexagon::BI__builtin_HEXAGON_V6_vaddcarrysat_128B, "v66" },
1938 { Hexagon::BI__builtin_HEXAGON_V6_vaddclbh, "v62,v65,v66" },
1939 { Hexagon::BI__builtin_HEXAGON_V6_vaddclbh_128B, "v62,v65,v66" },
1940 { Hexagon::BI__builtin_HEXAGON_V6_vaddclbw, "v62,v65,v66" },
1941 { Hexagon::BI__builtin_HEXAGON_V6_vaddclbw_128B, "v62,v65,v66" },
1942 { Hexagon::BI__builtin_HEXAGON_V6_vaddh, "v60,v62,v65,v66" },
1943 { Hexagon::BI__builtin_HEXAGON_V6_vaddh_128B, "v60,v62,v65,v66" },
1944 { Hexagon::BI__builtin_HEXAGON_V6_vaddh_dv, "v60,v62,v65,v66" },
1945 { Hexagon::BI__builtin_HEXAGON_V6_vaddh_dv_128B, "v60,v62,v65,v66" },
1946 { Hexagon::BI__builtin_HEXAGON_V6_vaddhsat, "v60,v62,v65,v66" },
1947 { Hexagon::BI__builtin_HEXAGON_V6_vaddhsat_128B, "v60,v62,v65,v66" },
1948 { Hexagon::BI__builtin_HEXAGON_V6_vaddhsat_dv, "v60,v62,v65,v66" },
1949 { Hexagon::BI__builtin_HEXAGON_V6_vaddhsat_dv_128B, "v60,v62,v65,v66" },
1950 { Hexagon::BI__builtin_HEXAGON_V6_vaddhw, "v60,v62,v65,v66" },
1951 { Hexagon::BI__builtin_HEXAGON_V6_vaddhw_128B, "v60,v62,v65,v66" },
1952 { Hexagon::BI__builtin_HEXAGON_V6_vaddhw_acc, "v62,v65,v66" },
1953 { Hexagon::BI__builtin_HEXAGON_V6_vaddhw_acc_128B, "v62,v65,v66" },
1954 { Hexagon::BI__builtin_HEXAGON_V6_vaddubh, "v60,v62,v65,v66" },
1955 { Hexagon::BI__builtin_HEXAGON_V6_vaddubh_128B, "v60,v62,v65,v66" },
1956 { Hexagon::BI__builtin_HEXAGON_V6_vaddubh_acc, "v62,v65,v66" },
1957 { Hexagon::BI__builtin_HEXAGON_V6_vaddubh_acc_128B, "v62,v65,v66" },
1958 { Hexagon::BI__builtin_HEXAGON_V6_vaddubsat, "v60,v62,v65,v66" },
1959 { Hexagon::BI__builtin_HEXAGON_V6_vaddubsat_128B, "v60,v62,v65,v66" },
1960 { Hexagon::BI__builtin_HEXAGON_V6_vaddubsat_dv, "v60,v62,v65,v66" },
1961 { Hexagon::BI__builtin_HEXAGON_V6_vaddubsat_dv_128B, "v60,v62,v65,v66" },
1962 { Hexagon::BI__builtin_HEXAGON_V6_vaddububb_sat, "v62,v65,v66" },
1963 { Hexagon::BI__builtin_HEXAGON_V6_vaddububb_sat_128B, "v62,v65,v66" },
1964 { Hexagon::BI__builtin_HEXAGON_V6_vadduhsat, "v60,v62,v65,v66" },
1965 { Hexagon::BI__builtin_HEXAGON_V6_vadduhsat_128B, "v60,v62,v65,v66" },
1966 { Hexagon::BI__builtin_HEXAGON_V6_vadduhsat_dv, "v60,v62,v65,v66" },
1967 { Hexagon::BI__builtin_HEXAGON_V6_vadduhsat_dv_128B, "v60,v62,v65,v66" },
1968 { Hexagon::BI__builtin_HEXAGON_V6_vadduhw, "v60,v62,v65,v66" },
1969 { Hexagon::BI__builtin_HEXAGON_V6_vadduhw_128B, "v60,v62,v65,v66" },
1970 { Hexagon::BI__builtin_HEXAGON_V6_vadduhw_acc, "v62,v65,v66" },
1971 { Hexagon::BI__builtin_HEXAGON_V6_vadduhw_acc_128B, "v62,v65,v66" },
1972 { Hexagon::BI__builtin_HEXAGON_V6_vadduwsat, "v62,v65,v66" },
1973 { Hexagon::BI__builtin_HEXAGON_V6_vadduwsat_128B, "v62,v65,v66" },
1974 { Hexagon::BI__builtin_HEXAGON_V6_vadduwsat_dv, "v62,v65,v66" },
1975 { Hexagon::BI__builtin_HEXAGON_V6_vadduwsat_dv_128B, "v62,v65,v66" },
1976 { Hexagon::BI__builtin_HEXAGON_V6_vaddw, "v60,v62,v65,v66" },
1977 { Hexagon::BI__builtin_HEXAGON_V6_vaddw_128B, "v60,v62,v65,v66" },
1978 { Hexagon::BI__builtin_HEXAGON_V6_vaddw_dv, "v60,v62,v65,v66" },
1979 { Hexagon::BI__builtin_HEXAGON_V6_vaddw_dv_128B, "v60,v62,v65,v66" },
1980 { Hexagon::BI__builtin_HEXAGON_V6_vaddwsat, "v60,v62,v65,v66" },
1981 { Hexagon::BI__builtin_HEXAGON_V6_vaddwsat_128B, "v60,v62,v65,v66" },
1982 { Hexagon::BI__builtin_HEXAGON_V6_vaddwsat_dv, "v60,v62,v65,v66" },
1983 { Hexagon::BI__builtin_HEXAGON_V6_vaddwsat_dv_128B, "v60,v62,v65,v66" },
1984 { Hexagon::BI__builtin_HEXAGON_V6_valignb, "v60,v62,v65,v66" },
1985 { Hexagon::BI__builtin_HEXAGON_V6_valignb_128B, "v60,v62,v65,v66" },
1986 { Hexagon::BI__builtin_HEXAGON_V6_valignbi, "v60,v62,v65,v66" },
1987 { Hexagon::BI__builtin_HEXAGON_V6_valignbi_128B, "v60,v62,v65,v66" },
1988 { Hexagon::BI__builtin_HEXAGON_V6_vand, "v60,v62,v65,v66" },
1989 { Hexagon::BI__builtin_HEXAGON_V6_vand_128B, "v60,v62,v65,v66" },
1990 { Hexagon::BI__builtin_HEXAGON_V6_vandnqrt, "v62,v65,v66" },
1991 { Hexagon::BI__builtin_HEXAGON_V6_vandnqrt_128B, "v62,v65,v66" },
1992 { Hexagon::BI__builtin_HEXAGON_V6_vandnqrt_acc, "v62,v65,v66" },
1993 { Hexagon::BI__builtin_HEXAGON_V6_vandnqrt_acc_128B, "v62,v65,v66" },
1994 { Hexagon::BI__builtin_HEXAGON_V6_vandqrt, "v60,v62,v65,v66" },
1995 { Hexagon::BI__builtin_HEXAGON_V6_vandqrt_128B, "v60,v62,v65,v66" },
1996 { Hexagon::BI__builtin_HEXAGON_V6_vandqrt_acc, "v60,v62,v65,v66" },
1997 { Hexagon::BI__builtin_HEXAGON_V6_vandqrt_acc_128B, "v60,v62,v65,v66" },
1998 { Hexagon::BI__builtin_HEXAGON_V6_vandvnqv, "v62,v65,v66" },
1999 { Hexagon::BI__builtin_HEXAGON_V6_vandvnqv_128B, "v62,v65,v66" },
2000 { Hexagon::BI__builtin_HEXAGON_V6_vandvqv, "v62,v65,v66" },
2001 { Hexagon::BI__builtin_HEXAGON_V6_vandvqv_128B, "v62,v65,v66" },
2002 { Hexagon::BI__builtin_HEXAGON_V6_vandvrt, "v60,v62,v65,v66" },
2003 { Hexagon::BI__builtin_HEXAGON_V6_vandvrt_128B, "v60,v62,v65,v66" },
2004 { Hexagon::BI__builtin_HEXAGON_V6_vandvrt_acc, "v60,v62,v65,v66" },
2005 { Hexagon::BI__builtin_HEXAGON_V6_vandvrt_acc_128B, "v60,v62,v65,v66" },
2006 { Hexagon::BI__builtin_HEXAGON_V6_vaslh, "v60,v62,v65,v66" },
2007 { Hexagon::BI__builtin_HEXAGON_V6_vaslh_128B, "v60,v62,v65,v66" },
2008 { Hexagon::BI__builtin_HEXAGON_V6_vaslh_acc, "v65,v66" },
2009 { Hexagon::BI__builtin_HEXAGON_V6_vaslh_acc_128B, "v65,v66" },
2010 { Hexagon::BI__builtin_HEXAGON_V6_vaslhv, "v60,v62,v65,v66" },
2011 { Hexagon::BI__builtin_HEXAGON_V6_vaslhv_128B, "v60,v62,v65,v66" },
2012 { Hexagon::BI__builtin_HEXAGON_V6_vaslw, "v60,v62,v65,v66" },
2013 { Hexagon::BI__builtin_HEXAGON_V6_vaslw_128B, "v60,v62,v65,v66" },
2014 { Hexagon::BI__builtin_HEXAGON_V6_vaslw_acc, "v60,v62,v65,v66" },
2015 { Hexagon::BI__builtin_HEXAGON_V6_vaslw_acc_128B, "v60,v62,v65,v66" },
2016 { Hexagon::BI__builtin_HEXAGON_V6_vaslwv, "v60,v62,v65,v66" },
2017 { Hexagon::BI__builtin_HEXAGON_V6_vaslwv_128B, "v60,v62,v65,v66" },
2018 { Hexagon::BI__builtin_HEXAGON_V6_vasrh, "v60,v62,v65,v66" },
2019 { Hexagon::BI__builtin_HEXAGON_V6_vasrh_128B, "v60,v62,v65,v66" },
2020 { Hexagon::BI__builtin_HEXAGON_V6_vasrh_acc, "v65,v66" },
2021 { Hexagon::BI__builtin_HEXAGON_V6_vasrh_acc_128B, "v65,v66" },
2022 { Hexagon::BI__builtin_HEXAGON_V6_vasrhbrndsat, "v60,v62,v65,v66" },
2023 { Hexagon::BI__builtin_HEXAGON_V6_vasrhbrndsat_128B, "v60,v62,v65,v66" },
2024 { Hexagon::BI__builtin_HEXAGON_V6_vasrhbsat, "v62,v65,v66" },
2025 { Hexagon::BI__builtin_HEXAGON_V6_vasrhbsat_128B, "v62,v65,v66" },
2026 { Hexagon::BI__builtin_HEXAGON_V6_vasrhubrndsat, "v60,v62,v65,v66" },
2027 { Hexagon::BI__builtin_HEXAGON_V6_vasrhubrndsat_128B, "v60,v62,v65,v66" },
2028 { Hexagon::BI__builtin_HEXAGON_V6_vasrhubsat, "v60,v62,v65,v66" },
2029 { Hexagon::BI__builtin_HEXAGON_V6_vasrhubsat_128B, "v60,v62,v65,v66" },
2030 { Hexagon::BI__builtin_HEXAGON_V6_vasrhv, "v60,v62,v65,v66" },
2031 { Hexagon::BI__builtin_HEXAGON_V6_vasrhv_128B, "v60,v62,v65,v66" },
2032 { Hexagon::BI__builtin_HEXAGON_V6_vasr_into, "v66" },
2033 { Hexagon::BI__builtin_HEXAGON_V6_vasr_into_128B, "v66" },
2034 { Hexagon::BI__builtin_HEXAGON_V6_vasruhubrndsat, "v65,v66" },
2035 { Hexagon::BI__builtin_HEXAGON_V6_vasruhubrndsat_128B, "v65,v66" },
2036 { Hexagon::BI__builtin_HEXAGON_V6_vasruhubsat, "v65,v66" },
2037 { Hexagon::BI__builtin_HEXAGON_V6_vasruhubsat_128B, "v65,v66" },
2038 { Hexagon::BI__builtin_HEXAGON_V6_vasruwuhrndsat, "v62,v65,v66" },
2039 { Hexagon::BI__builtin_HEXAGON_V6_vasruwuhrndsat_128B, "v62,v65,v66" },
2040 { Hexagon::BI__builtin_HEXAGON_V6_vasruwuhsat, "v65,v66" },
2041 { Hexagon::BI__builtin_HEXAGON_V6_vasruwuhsat_128B, "v65,v66" },
2042 { Hexagon::BI__builtin_HEXAGON_V6_vasrw, "v60,v62,v65,v66" },
2043 { Hexagon::BI__builtin_HEXAGON_V6_vasrw_128B, "v60,v62,v65,v66" },
2044 { Hexagon::BI__builtin_HEXAGON_V6_vasrw_acc, "v60,v62,v65,v66" },
2045 { Hexagon::BI__builtin_HEXAGON_V6_vasrw_acc_128B, "v60,v62,v65,v66" },
2046 { Hexagon::BI__builtin_HEXAGON_V6_vasrwh, "v60,v62,v65,v66" },
2047 { Hexagon::BI__builtin_HEXAGON_V6_vasrwh_128B, "v60,v62,v65,v66" },
2048 { Hexagon::BI__builtin_HEXAGON_V6_vasrwhrndsat, "v60,v62,v65,v66" },
2049 { Hexagon::BI__builtin_HEXAGON_V6_vasrwhrndsat_128B, "v60,v62,v65,v66" },
2050 { Hexagon::BI__builtin_HEXAGON_V6_vasrwhsat, "v60,v62,v65,v66" },
2051 { Hexagon::BI__builtin_HEXAGON_V6_vasrwhsat_128B, "v60,v62,v65,v66" },
2052 { Hexagon::BI__builtin_HEXAGON_V6_vasrwuhrndsat, "v62,v65,v66" },
2053 { Hexagon::BI__builtin_HEXAGON_V6_vasrwuhrndsat_128B, "v62,v65,v66" },
2054 { Hexagon::BI__builtin_HEXAGON_V6_vasrwuhsat, "v60,v62,v65,v66" },
2055 { Hexagon::BI__builtin_HEXAGON_V6_vasrwuhsat_128B, "v60,v62,v65,v66" },
2056 { Hexagon::BI__builtin_HEXAGON_V6_vasrwv, "v60,v62,v65,v66" },
2057 { Hexagon::BI__builtin_HEXAGON_V6_vasrwv_128B, "v60,v62,v65,v66" },
2058 { Hexagon::BI__builtin_HEXAGON_V6_vassign, "v60,v62,v65,v66" },
2059 { Hexagon::BI__builtin_HEXAGON_V6_vassign_128B, "v60,v62,v65,v66" },
2060 { Hexagon::BI__builtin_HEXAGON_V6_vassignp, "v60,v62,v65,v66" },
2061 { Hexagon::BI__builtin_HEXAGON_V6_vassignp_128B, "v60,v62,v65,v66" },
2062 { Hexagon::BI__builtin_HEXAGON_V6_vavgb, "v65,v66" },
2063 { Hexagon::BI__builtin_HEXAGON_V6_vavgb_128B, "v65,v66" },
2064 { Hexagon::BI__builtin_HEXAGON_V6_vavgbrnd, "v65,v66" },
2065 { Hexagon::BI__builtin_HEXAGON_V6_vavgbrnd_128B, "v65,v66" },
2066 { Hexagon::BI__builtin_HEXAGON_V6_vavgh, "v60,v62,v65,v66" },
2067 { Hexagon::BI__builtin_HEXAGON_V6_vavgh_128B, "v60,v62,v65,v66" },
2068 { Hexagon::BI__builtin_HEXAGON_V6_vavghrnd, "v60,v62,v65,v66" },
2069 { Hexagon::BI__builtin_HEXAGON_V6_vavghrnd_128B, "v60,v62,v65,v66" },
2070 { Hexagon::BI__builtin_HEXAGON_V6_vavgub, "v60,v62,v65,v66" },
2071 { Hexagon::BI__builtin_HEXAGON_V6_vavgub_128B, "v60,v62,v65,v66" },
2072 { Hexagon::BI__builtin_HEXAGON_V6_vavgubrnd, "v60,v62,v65,v66" },
2073 { Hexagon::BI__builtin_HEXAGON_V6_vavgubrnd_128B, "v60,v62,v65,v66" },
2074 { Hexagon::BI__builtin_HEXAGON_V6_vavguh, "v60,v62,v65,v66" },
2075 { Hexagon::BI__builtin_HEXAGON_V6_vavguh_128B, "v60,v62,v65,v66" },
2076 { Hexagon::BI__builtin_HEXAGON_V6_vavguhrnd, "v60,v62,v65,v66" },
2077 { Hexagon::BI__builtin_HEXAGON_V6_vavguhrnd_128B, "v60,v62,v65,v66" },
2078 { Hexagon::BI__builtin_HEXAGON_V6_vavguw, "v65,v66" },
2079 { Hexagon::BI__builtin_HEXAGON_V6_vavguw_128B, "v65,v66" },
2080 { Hexagon::BI__builtin_HEXAGON_V6_vavguwrnd, "v65,v66" },
2081 { Hexagon::BI__builtin_HEXAGON_V6_vavguwrnd_128B, "v65,v66" },
2082 { Hexagon::BI__builtin_HEXAGON_V6_vavgw, "v60,v62,v65,v66" },
2083 { Hexagon::BI__builtin_HEXAGON_V6_vavgw_128B, "v60,v62,v65,v66" },
2084 { Hexagon::BI__builtin_HEXAGON_V6_vavgwrnd, "v60,v62,v65,v66" },
2085 { Hexagon::BI__builtin_HEXAGON_V6_vavgwrnd_128B, "v60,v62,v65,v66" },
2086 { Hexagon::BI__builtin_HEXAGON_V6_vcl0h, "v60,v62,v65,v66" },
2087 { Hexagon::BI__builtin_HEXAGON_V6_vcl0h_128B, "v60,v62,v65,v66" },
2088 { Hexagon::BI__builtin_HEXAGON_V6_vcl0w, "v60,v62,v65,v66" },
2089 { Hexagon::BI__builtin_HEXAGON_V6_vcl0w_128B, "v60,v62,v65,v66" },
2090 { Hexagon::BI__builtin_HEXAGON_V6_vcombine, "v60,v62,v65,v66" },
2091 { Hexagon::BI__builtin_HEXAGON_V6_vcombine_128B, "v60,v62,v65,v66" },
2092 { Hexagon::BI__builtin_HEXAGON_V6_vd0, "v60,v62,v65,v66" },
2093 { Hexagon::BI__builtin_HEXAGON_V6_vd0_128B, "v60,v62,v65,v66" },
2094 { Hexagon::BI__builtin_HEXAGON_V6_vdd0, "v65,v66" },
2095 { Hexagon::BI__builtin_HEXAGON_V6_vdd0_128B, "v65,v66" },
2096 { Hexagon::BI__builtin_HEXAGON_V6_vdealb, "v60,v62,v65,v66" },
2097 { Hexagon::BI__builtin_HEXAGON_V6_vdealb_128B, "v60,v62,v65,v66" },
2098 { Hexagon::BI__builtin_HEXAGON_V6_vdealb4w, "v60,v62,v65,v66" },
2099 { Hexagon::BI__builtin_HEXAGON_V6_vdealb4w_128B, "v60,v62,v65,v66" },
2100 { Hexagon::BI__builtin_HEXAGON_V6_vdealh, "v60,v62,v65,v66" },
2101 { Hexagon::BI__builtin_HEXAGON_V6_vdealh_128B, "v60,v62,v65,v66" },
2102 { Hexagon::BI__builtin_HEXAGON_V6_vdealvdd, "v60,v62,v65,v66" },
2103 { Hexagon::BI__builtin_HEXAGON_V6_vdealvdd_128B, "v60,v62,v65,v66" },
2104 { Hexagon::BI__builtin_HEXAGON_V6_vdelta, "v60,v62,v65,v66" },
2105 { Hexagon::BI__builtin_HEXAGON_V6_vdelta_128B, "v60,v62,v65,v66" },
2106 { Hexagon::BI__builtin_HEXAGON_V6_vdmpybus, "v60,v62,v65,v66" },
2107 { Hexagon::BI__builtin_HEXAGON_V6_vdmpybus_128B, "v60,v62,v65,v66" },
2108 { Hexagon::BI__builtin_HEXAGON_V6_vdmpybus_acc, "v60,v62,v65,v66" },
2109 { Hexagon::BI__builtin_HEXAGON_V6_vdmpybus_acc_128B, "v60,v62,v65,v66" },
2110 { Hexagon::BI__builtin_HEXAGON_V6_vdmpybus_dv, "v60,v62,v65,v66" },
2111 { Hexagon::BI__builtin_HEXAGON_V6_vdmpybus_dv_128B, "v60,v62,v65,v66" },
2112 { Hexagon::BI__builtin_HEXAGON_V6_vdmpybus_dv_acc, "v60,v62,v65,v66" },
2113 { Hexagon::BI__builtin_HEXAGON_V6_vdmpybus_dv_acc_128B, "v60,v62,v65,v66" },
2114 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhb, "v60,v62,v65,v66" },
2115 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhb_128B, "v60,v62,v65,v66" },
2116 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhb_acc, "v60,v62,v65,v66" },
2117 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhb_acc_128B, "v60,v62,v65,v66" },
2118 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhb_dv, "v60,v62,v65,v66" },
2119 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhb_dv_128B, "v60,v62,v65,v66" },
2120 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhb_dv_acc, "v60,v62,v65,v66" },
2121 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhb_dv_acc_128B, "v60,v62,v65,v66" },
2122 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhisat, "v60,v62,v65,v66" },
2123 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhisat_128B, "v60,v62,v65,v66" },
2124 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhisat_acc, "v60,v62,v65,v66" },
2125 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhisat_acc_128B, "v60,v62,v65,v66" },
2126 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhsat, "v60,v62,v65,v66" },
2127 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhsat_128B, "v60,v62,v65,v66" },
2128 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhsat_acc, "v60,v62,v65,v66" },
2129 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhsat_acc_128B, "v60,v62,v65,v66" },
2130 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhsuisat, "v60,v62,v65,v66" },
2131 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhsuisat_128B, "v60,v62,v65,v66" },
2132 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhsuisat_acc, "v60,v62,v65,v66" },
2133 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhsuisat_acc_128B, "v60,v62,v65,v66" },
2134 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhsusat, "v60,v62,v65,v66" },
2135 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhsusat_128B, "v60,v62,v65,v66" },
2136 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhsusat_acc, "v60,v62,v65,v66" },
2137 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhsusat_acc_128B, "v60,v62,v65,v66" },
2138 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhvsat, "v60,v62,v65,v66" },
2139 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhvsat_128B, "v60,v62,v65,v66" },
2140 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhvsat_acc, "v60,v62,v65,v66" },
2141 { Hexagon::BI__builtin_HEXAGON_V6_vdmpyhvsat_acc_128B, "v60,v62,v65,v66" },
2142 { Hexagon::BI__builtin_HEXAGON_V6_vdsaduh, "v60,v62,v65,v66" },
2143 { Hexagon::BI__builtin_HEXAGON_V6_vdsaduh_128B, "v60,v62,v65,v66" },
2144 { Hexagon::BI__builtin_HEXAGON_V6_vdsaduh_acc, "v60,v62,v65,v66" },
2145 { Hexagon::BI__builtin_HEXAGON_V6_vdsaduh_acc_128B, "v60,v62,v65,v66" },
2146 { Hexagon::BI__builtin_HEXAGON_V6_veqb, "v60,v62,v65,v66" },
2147 { Hexagon::BI__builtin_HEXAGON_V6_veqb_128B, "v60,v62,v65,v66" },
2148 { Hexagon::BI__builtin_HEXAGON_V6_veqb_and, "v60,v62,v65,v66" },
2149 { Hexagon::BI__builtin_HEXAGON_V6_veqb_and_128B, "v60,v62,v65,v66" },
2150 { Hexagon::BI__builtin_HEXAGON_V6_veqb_or, "v60,v62,v65,v66" },
2151 { Hexagon::BI__builtin_HEXAGON_V6_veqb_or_128B, "v60,v62,v65,v66" },
2152 { Hexagon::BI__builtin_HEXAGON_V6_veqb_xor, "v60,v62,v65,v66" },
2153 { Hexagon::BI__builtin_HEXAGON_V6_veqb_xor_128B, "v60,v62,v65,v66" },
2154 { Hexagon::BI__builtin_HEXAGON_V6_veqh, "v60,v62,v65,v66" },
2155 { Hexagon::BI__builtin_HEXAGON_V6_veqh_128B, "v60,v62,v65,v66" },
2156 { Hexagon::BI__builtin_HEXAGON_V6_veqh_and, "v60,v62,v65,v66" },
2157 { Hexagon::BI__builtin_HEXAGON_V6_veqh_and_128B, "v60,v62,v65,v66" },
2158 { Hexagon::BI__builtin_HEXAGON_V6_veqh_or, "v60,v62,v65,v66" },
2159 { Hexagon::BI__builtin_HEXAGON_V6_veqh_or_128B, "v60,v62,v65,v66" },
2160 { Hexagon::BI__builtin_HEXAGON_V6_veqh_xor, "v60,v62,v65,v66" },
2161 { Hexagon::BI__builtin_HEXAGON_V6_veqh_xor_128B, "v60,v62,v65,v66" },
2162 { Hexagon::BI__builtin_HEXAGON_V6_veqw, "v60,v62,v65,v66" },
2163 { Hexagon::BI__builtin_HEXAGON_V6_veqw_128B, "v60,v62,v65,v66" },
2164 { Hexagon::BI__builtin_HEXAGON_V6_veqw_and, "v60,v62,v65,v66" },
2165 { Hexagon::BI__builtin_HEXAGON_V6_veqw_and_128B, "v60,v62,v65,v66" },
2166 { Hexagon::BI__builtin_HEXAGON_V6_veqw_or, "v60,v62,v65,v66" },
2167 { Hexagon::BI__builtin_HEXAGON_V6_veqw_or_128B, "v60,v62,v65,v66" },
2168 { Hexagon::BI__builtin_HEXAGON_V6_veqw_xor, "v60,v62,v65,v66" },
2169 { Hexagon::BI__builtin_HEXAGON_V6_veqw_xor_128B, "v60,v62,v65,v66" },
2170 { Hexagon::BI__builtin_HEXAGON_V6_vgtb, "v60,v62,v65,v66" },
2171 { Hexagon::BI__builtin_HEXAGON_V6_vgtb_128B, "v60,v62,v65,v66" },
2172 { Hexagon::BI__builtin_HEXAGON_V6_vgtb_and, "v60,v62,v65,v66" },
2173 { Hexagon::BI__builtin_HEXAGON_V6_vgtb_and_128B, "v60,v62,v65,v66" },
2174 { Hexagon::BI__builtin_HEXAGON_V6_vgtb_or, "v60,v62,v65,v66" },
2175 { Hexagon::BI__builtin_HEXAGON_V6_vgtb_or_128B, "v60,v62,v65,v66" },
2176 { Hexagon::BI__builtin_HEXAGON_V6_vgtb_xor, "v60,v62,v65,v66" },
2177 { Hexagon::BI__builtin_HEXAGON_V6_vgtb_xor_128B, "v60,v62,v65,v66" },
2178 { Hexagon::BI__builtin_HEXAGON_V6_vgth, "v60,v62,v65,v66" },
2179 { Hexagon::BI__builtin_HEXAGON_V6_vgth_128B, "v60,v62,v65,v66" },
2180 { Hexagon::BI__builtin_HEXAGON_V6_vgth_and, "v60,v62,v65,v66" },
2181 { Hexagon::BI__builtin_HEXAGON_V6_vgth_and_128B, "v60,v62,v65,v66" },
2182 { Hexagon::BI__builtin_HEXAGON_V6_vgth_or, "v60,v62,v65,v66" },
2183 { Hexagon::BI__builtin_HEXAGON_V6_vgth_or_128B, "v60,v62,v65,v66" },
2184 { Hexagon::BI__builtin_HEXAGON_V6_vgth_xor, "v60,v62,v65,v66" },
2185 { Hexagon::BI__builtin_HEXAGON_V6_vgth_xor_128B, "v60,v62,v65,v66" },
2186 { Hexagon::BI__builtin_HEXAGON_V6_vgtub, "v60,v62,v65,v66" },
2187 { Hexagon::BI__builtin_HEXAGON_V6_vgtub_128B, "v60,v62,v65,v66" },
2188 { Hexagon::BI__builtin_HEXAGON_V6_vgtub_and, "v60,v62,v65,v66" },
2189 { Hexagon::BI__builtin_HEXAGON_V6_vgtub_and_128B, "v60,v62,v65,v66" },
2190 { Hexagon::BI__builtin_HEXAGON_V6_vgtub_or, "v60,v62,v65,v66" },
2191 { Hexagon::BI__builtin_HEXAGON_V6_vgtub_or_128B, "v60,v62,v65,v66" },
2192 { Hexagon::BI__builtin_HEXAGON_V6_vgtub_xor, "v60,v62,v65,v66" },
2193 { Hexagon::BI__builtin_HEXAGON_V6_vgtub_xor_128B, "v60,v62,v65,v66" },
2194 { Hexagon::BI__builtin_HEXAGON_V6_vgtuh, "v60,v62,v65,v66" },
2195 { Hexagon::BI__builtin_HEXAGON_V6_vgtuh_128B, "v60,v62,v65,v66" },
2196 { Hexagon::BI__builtin_HEXAGON_V6_vgtuh_and, "v60,v62,v65,v66" },
2197 { Hexagon::BI__builtin_HEXAGON_V6_vgtuh_and_128B, "v60,v62,v65,v66" },
2198 { Hexagon::BI__builtin_HEXAGON_V6_vgtuh_or, "v60,v62,v65,v66" },
2199 { Hexagon::BI__builtin_HEXAGON_V6_vgtuh_or_128B, "v60,v62,v65,v66" },
2200 { Hexagon::BI__builtin_HEXAGON_V6_vgtuh_xor, "v60,v62,v65,v66" },
2201 { Hexagon::BI__builtin_HEXAGON_V6_vgtuh_xor_128B, "v60,v62,v65,v66" },
2202 { Hexagon::BI__builtin_HEXAGON_V6_vgtuw, "v60,v62,v65,v66" },
2203 { Hexagon::BI__builtin_HEXAGON_V6_vgtuw_128B, "v60,v62,v65,v66" },
2204 { Hexagon::BI__builtin_HEXAGON_V6_vgtuw_and, "v60,v62,v65,v66" },
2205 { Hexagon::BI__builtin_HEXAGON_V6_vgtuw_and_128B, "v60,v62,v65,v66" },
2206 { Hexagon::BI__builtin_HEXAGON_V6_vgtuw_or, "v60,v62,v65,v66" },
2207 { Hexagon::BI__builtin_HEXAGON_V6_vgtuw_or_128B, "v60,v62,v65,v66" },
2208 { Hexagon::BI__builtin_HEXAGON_V6_vgtuw_xor, "v60,v62,v65,v66" },
2209 { Hexagon::BI__builtin_HEXAGON_V6_vgtuw_xor_128B, "v60,v62,v65,v66" },
2210 { Hexagon::BI__builtin_HEXAGON_V6_vgtw, "v60,v62,v65,v66" },
2211 { Hexagon::BI__builtin_HEXAGON_V6_vgtw_128B, "v60,v62,v65,v66" },
2212 { Hexagon::BI__builtin_HEXAGON_V6_vgtw_and, "v60,v62,v65,v66" },
2213 { Hexagon::BI__builtin_HEXAGON_V6_vgtw_and_128B, "v60,v62,v65,v66" },
2214 { Hexagon::BI__builtin_HEXAGON_V6_vgtw_or, "v60,v62,v65,v66" },
2215 { Hexagon::BI__builtin_HEXAGON_V6_vgtw_or_128B, "v60,v62,v65,v66" },
2216 { Hexagon::BI__builtin_HEXAGON_V6_vgtw_xor, "v60,v62,v65,v66" },
2217 { Hexagon::BI__builtin_HEXAGON_V6_vgtw_xor_128B, "v60,v62,v65,v66" },
2218 { Hexagon::BI__builtin_HEXAGON_V6_vinsertwr, "v60,v62,v65,v66" },
2219 { Hexagon::BI__builtin_HEXAGON_V6_vinsertwr_128B, "v60,v62,v65,v66" },
2220 { Hexagon::BI__builtin_HEXAGON_V6_vlalignb, "v60,v62,v65,v66" },
2221 { Hexagon::BI__builtin_HEXAGON_V6_vlalignb_128B, "v60,v62,v65,v66" },
2222 { Hexagon::BI__builtin_HEXAGON_V6_vlalignbi, "v60,v62,v65,v66" },
2223 { Hexagon::BI__builtin_HEXAGON_V6_vlalignbi_128B, "v60,v62,v65,v66" },
2224 { Hexagon::BI__builtin_HEXAGON_V6_vlsrb, "v62,v65,v66" },
2225 { Hexagon::BI__builtin_HEXAGON_V6_vlsrb_128B, "v62,v65,v66" },
2226 { Hexagon::BI__builtin_HEXAGON_V6_vlsrh, "v60,v62,v65,v66" },
2227 { Hexagon::BI__builtin_HEXAGON_V6_vlsrh_128B, "v60,v62,v65,v66" },
2228 { Hexagon::BI__builtin_HEXAGON_V6_vlsrhv, "v60,v62,v65,v66" },
2229 { Hexagon::BI__builtin_HEXAGON_V6_vlsrhv_128B, "v60,v62,v65,v66" },
2230 { Hexagon::BI__builtin_HEXAGON_V6_vlsrw, "v60,v62,v65,v66" },
2231 { Hexagon::BI__builtin_HEXAGON_V6_vlsrw_128B, "v60,v62,v65,v66" },
2232 { Hexagon::BI__builtin_HEXAGON_V6_vlsrwv, "v60,v62,v65,v66" },
2233 { Hexagon::BI__builtin_HEXAGON_V6_vlsrwv_128B, "v60,v62,v65,v66" },
2234 { Hexagon::BI__builtin_HEXAGON_V6_vlut4, "v65,v66" },
2235 { Hexagon::BI__builtin_HEXAGON_V6_vlut4_128B, "v65,v66" },
2236 { Hexagon::BI__builtin_HEXAGON_V6_vlutvvb, "v60,v62,v65,v66" },
2237 { Hexagon::BI__builtin_HEXAGON_V6_vlutvvb_128B, "v60,v62,v65,v66" },
2238 { Hexagon::BI__builtin_HEXAGON_V6_vlutvvbi, "v62,v65,v66" },
2239 { Hexagon::BI__builtin_HEXAGON_V6_vlutvvbi_128B, "v62,v65,v66" },
2240 { Hexagon::BI__builtin_HEXAGON_V6_vlutvvb_nm, "v62,v65,v66" },
2241 { Hexagon::BI__builtin_HEXAGON_V6_vlutvvb_nm_128B, "v62,v65,v66" },
2242 { Hexagon::BI__builtin_HEXAGON_V6_vlutvvb_oracc, "v60,v62,v65,v66" },
2243 { Hexagon::BI__builtin_HEXAGON_V6_vlutvvb_oracc_128B, "v60,v62,v65,v66" },
2244 { Hexagon::BI__builtin_HEXAGON_V6_vlutvvb_oracci, "v62,v65,v66" },
2245 { Hexagon::BI__builtin_HEXAGON_V6_vlutvvb_oracci_128B, "v62,v65,v66" },
2246 { Hexagon::BI__builtin_HEXAGON_V6_vlutvwh, "v60,v62,v65,v66" },
2247 { Hexagon::BI__builtin_HEXAGON_V6_vlutvwh_128B, "v60,v62,v65,v66" },
2248 { Hexagon::BI__builtin_HEXAGON_V6_vlutvwhi, "v62,v65,v66" },
2249 { Hexagon::BI__builtin_HEXAGON_V6_vlutvwhi_128B, "v62,v65,v66" },
2250 { Hexagon::BI__builtin_HEXAGON_V6_vlutvwh_nm, "v62,v65,v66" },
2251 { Hexagon::BI__builtin_HEXAGON_V6_vlutvwh_nm_128B, "v62,v65,v66" },
2252 { Hexagon::BI__builtin_HEXAGON_V6_vlutvwh_oracc, "v60,v62,v65,v66" },
2253 { Hexagon::BI__builtin_HEXAGON_V6_vlutvwh_oracc_128B, "v60,v62,v65,v66" },
2254 { Hexagon::BI__builtin_HEXAGON_V6_vlutvwh_oracci, "v62,v65,v66" },
2255 { Hexagon::BI__builtin_HEXAGON_V6_vlutvwh_oracci_128B, "v62,v65,v66" },
2256 { Hexagon::BI__builtin_HEXAGON_V6_vmaxb, "v62,v65,v66" },
2257 { Hexagon::BI__builtin_HEXAGON_V6_vmaxb_128B, "v62,v65,v66" },
2258 { Hexagon::BI__builtin_HEXAGON_V6_vmaxh, "v60,v62,v65,v66" },
2259 { Hexagon::BI__builtin_HEXAGON_V6_vmaxh_128B, "v60,v62,v65,v66" },
2260 { Hexagon::BI__builtin_HEXAGON_V6_vmaxub, "v60,v62,v65,v66" },
2261 { Hexagon::BI__builtin_HEXAGON_V6_vmaxub_128B, "v60,v62,v65,v66" },
2262 { Hexagon::BI__builtin_HEXAGON_V6_vmaxuh, "v60,v62,v65,v66" },
2263 { Hexagon::BI__builtin_HEXAGON_V6_vmaxuh_128B, "v60,v62,v65,v66" },
2264 { Hexagon::BI__builtin_HEXAGON_V6_vmaxw, "v60,v62,v65,v66" },
2265 { Hexagon::BI__builtin_HEXAGON_V6_vmaxw_128B, "v60,v62,v65,v66" },
2266 { Hexagon::BI__builtin_HEXAGON_V6_vminb, "v62,v65,v66" },
2267 { Hexagon::BI__builtin_HEXAGON_V6_vminb_128B, "v62,v65,v66" },
2268 { Hexagon::BI__builtin_HEXAGON_V6_vminh, "v60,v62,v65,v66" },
2269 { Hexagon::BI__builtin_HEXAGON_V6_vminh_128B, "v60,v62,v65,v66" },
2270 { Hexagon::BI__builtin_HEXAGON_V6_vminub, "v60,v62,v65,v66" },
2271 { Hexagon::BI__builtin_HEXAGON_V6_vminub_128B, "v60,v62,v65,v66" },
2272 { Hexagon::BI__builtin_HEXAGON_V6_vminuh, "v60,v62,v65,v66" },
2273 { Hexagon::BI__builtin_HEXAGON_V6_vminuh_128B, "v60,v62,v65,v66" },
2274 { Hexagon::BI__builtin_HEXAGON_V6_vminw, "v60,v62,v65,v66" },
2275 { Hexagon::BI__builtin_HEXAGON_V6_vminw_128B, "v60,v62,v65,v66" },
2276 { Hexagon::BI__builtin_HEXAGON_V6_vmpabus, "v60,v62,v65,v66" },
2277 { Hexagon::BI__builtin_HEXAGON_V6_vmpabus_128B, "v60,v62,v65,v66" },
2278 { Hexagon::BI__builtin_HEXAGON_V6_vmpabus_acc, "v60,v62,v65,v66" },
2279 { Hexagon::BI__builtin_HEXAGON_V6_vmpabus_acc_128B, "v60,v62,v65,v66" },
2280 { Hexagon::BI__builtin_HEXAGON_V6_vmpabusv, "v60,v62,v65,v66" },
2281 { Hexagon::BI__builtin_HEXAGON_V6_vmpabusv_128B, "v60,v62,v65,v66" },
2282 { Hexagon::BI__builtin_HEXAGON_V6_vmpabuu, "v65,v66" },
2283 { Hexagon::BI__builtin_HEXAGON_V6_vmpabuu_128B, "v65,v66" },
2284 { Hexagon::BI__builtin_HEXAGON_V6_vmpabuu_acc, "v65,v66" },
2285 { Hexagon::BI__builtin_HEXAGON_V6_vmpabuu_acc_128B, "v65,v66" },
2286 { Hexagon::BI__builtin_HEXAGON_V6_vmpabuuv, "v60,v62,v65,v66" },
2287 { Hexagon::BI__builtin_HEXAGON_V6_vmpabuuv_128B, "v60,v62,v65,v66" },
2288 { Hexagon::BI__builtin_HEXAGON_V6_vmpahb, "v60,v62,v65,v66" },
2289 { Hexagon::BI__builtin_HEXAGON_V6_vmpahb_128B, "v60,v62,v65,v66" },
2290 { Hexagon::BI__builtin_HEXAGON_V6_vmpahb_acc, "v60,v62,v65,v66" },
2291 { Hexagon::BI__builtin_HEXAGON_V6_vmpahb_acc_128B, "v60,v62,v65,v66" },
2292 { Hexagon::BI__builtin_HEXAGON_V6_vmpahhsat, "v65,v66" },
2293 { Hexagon::BI__builtin_HEXAGON_V6_vmpahhsat_128B, "v65,v66" },
2294 { Hexagon::BI__builtin_HEXAGON_V6_vmpauhb, "v62,v65,v66" },
2295 { Hexagon::BI__builtin_HEXAGON_V6_vmpauhb_128B, "v62,v65,v66" },
2296 { Hexagon::BI__builtin_HEXAGON_V6_vmpauhb_acc, "v62,v65,v66" },
2297 { Hexagon::BI__builtin_HEXAGON_V6_vmpauhb_acc_128B, "v62,v65,v66" },
2298 { Hexagon::BI__builtin_HEXAGON_V6_vmpauhuhsat, "v65,v66" },
2299 { Hexagon::BI__builtin_HEXAGON_V6_vmpauhuhsat_128B, "v65,v66" },
2300 { Hexagon::BI__builtin_HEXAGON_V6_vmpsuhuhsat, "v65,v66" },
2301 { Hexagon::BI__builtin_HEXAGON_V6_vmpsuhuhsat_128B, "v65,v66" },
2302 { Hexagon::BI__builtin_HEXAGON_V6_vmpybus, "v60,v62,v65,v66" },
2303 { Hexagon::BI__builtin_HEXAGON_V6_vmpybus_128B, "v60,v62,v65,v66" },
2304 { Hexagon::BI__builtin_HEXAGON_V6_vmpybus_acc, "v60,v62,v65,v66" },
2305 { Hexagon::BI__builtin_HEXAGON_V6_vmpybus_acc_128B, "v60,v62,v65,v66" },
2306 { Hexagon::BI__builtin_HEXAGON_V6_vmpybusv, "v60,v62,v65,v66" },
2307 { Hexagon::BI__builtin_HEXAGON_V6_vmpybusv_128B, "v60,v62,v65,v66" },
2308 { Hexagon::BI__builtin_HEXAGON_V6_vmpybusv_acc, "v60,v62,v65,v66" },
2309 { Hexagon::BI__builtin_HEXAGON_V6_vmpybusv_acc_128B, "v60,v62,v65,v66" },
2310 { Hexagon::BI__builtin_HEXAGON_V6_vmpybv, "v60,v62,v65,v66" },
2311 { Hexagon::BI__builtin_HEXAGON_V6_vmpybv_128B, "v60,v62,v65,v66" },
2312 { Hexagon::BI__builtin_HEXAGON_V6_vmpybv_acc, "v60,v62,v65,v66" },
2313 { Hexagon::BI__builtin_HEXAGON_V6_vmpybv_acc_128B, "v60,v62,v65,v66" },
2314 { Hexagon::BI__builtin_HEXAGON_V6_vmpyewuh, "v60,v62,v65,v66" },
2315 { Hexagon::BI__builtin_HEXAGON_V6_vmpyewuh_128B, "v60,v62,v65,v66" },
2316 { Hexagon::BI__builtin_HEXAGON_V6_vmpyewuh_64, "v62,v65,v66" },
2317 { Hexagon::BI__builtin_HEXAGON_V6_vmpyewuh_64_128B, "v62,v65,v66" },
2318 { Hexagon::BI__builtin_HEXAGON_V6_vmpyh, "v60,v62,v65,v66" },
2319 { Hexagon::BI__builtin_HEXAGON_V6_vmpyh_128B, "v60,v62,v65,v66" },
2320 { Hexagon::BI__builtin_HEXAGON_V6_vmpyh_acc, "v65,v66" },
2321 { Hexagon::BI__builtin_HEXAGON_V6_vmpyh_acc_128B, "v65,v66" },
2322 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhsat_acc, "v60,v62,v65,v66" },
2323 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhsat_acc_128B, "v60,v62,v65,v66" },
2324 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhsrs, "v60,v62,v65,v66" },
2325 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhsrs_128B, "v60,v62,v65,v66" },
2326 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhss, "v60,v62,v65,v66" },
2327 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhss_128B, "v60,v62,v65,v66" },
2328 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhus, "v60,v62,v65,v66" },
2329 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhus_128B, "v60,v62,v65,v66" },
2330 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhus_acc, "v60,v62,v65,v66" },
2331 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhus_acc_128B, "v60,v62,v65,v66" },
2332 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhv, "v60,v62,v65,v66" },
2333 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhv_128B, "v60,v62,v65,v66" },
2334 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhv_acc, "v60,v62,v65,v66" },
2335 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhv_acc_128B, "v60,v62,v65,v66" },
2336 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhvsrs, "v60,v62,v65,v66" },
2337 { Hexagon::BI__builtin_HEXAGON_V6_vmpyhvsrs_128B, "v60,v62,v65,v66" },
2338 { Hexagon::BI__builtin_HEXAGON_V6_vmpyieoh, "v60,v62,v65,v66" },
2339 { Hexagon::BI__builtin_HEXAGON_V6_vmpyieoh_128B, "v60,v62,v65,v66" },
2340 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiewh_acc, "v60,v62,v65,v66" },
2341 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiewh_acc_128B, "v60,v62,v65,v66" },
2342 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiewuh, "v60,v62,v65,v66" },
2343 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiewuh_128B, "v60,v62,v65,v66" },
2344 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiewuh_acc, "v60,v62,v65,v66" },
2345 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiewuh_acc_128B, "v60,v62,v65,v66" },
2346 { Hexagon::BI__builtin_HEXAGON_V6_vmpyih, "v60,v62,v65,v66" },
2347 { Hexagon::BI__builtin_HEXAGON_V6_vmpyih_128B, "v60,v62,v65,v66" },
2348 { Hexagon::BI__builtin_HEXAGON_V6_vmpyih_acc, "v60,v62,v65,v66" },
2349 { Hexagon::BI__builtin_HEXAGON_V6_vmpyih_acc_128B, "v60,v62,v65,v66" },
2350 { Hexagon::BI__builtin_HEXAGON_V6_vmpyihb, "v60,v62,v65,v66" },
2351 { Hexagon::BI__builtin_HEXAGON_V6_vmpyihb_128B, "v60,v62,v65,v66" },
2352 { Hexagon::BI__builtin_HEXAGON_V6_vmpyihb_acc, "v60,v62,v65,v66" },
2353 { Hexagon::BI__builtin_HEXAGON_V6_vmpyihb_acc_128B, "v60,v62,v65,v66" },
2354 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiowh, "v60,v62,v65,v66" },
2355 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiowh_128B, "v60,v62,v65,v66" },
2356 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiwb, "v60,v62,v65,v66" },
2357 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiwb_128B, "v60,v62,v65,v66" },
2358 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiwb_acc, "v60,v62,v65,v66" },
2359 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiwb_acc_128B, "v60,v62,v65,v66" },
2360 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiwh, "v60,v62,v65,v66" },
2361 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiwh_128B, "v60,v62,v65,v66" },
2362 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiwh_acc, "v60,v62,v65,v66" },
2363 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiwh_acc_128B, "v60,v62,v65,v66" },
2364 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiwub, "v62,v65,v66" },
2365 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiwub_128B, "v62,v65,v66" },
2366 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiwub_acc, "v62,v65,v66" },
2367 { Hexagon::BI__builtin_HEXAGON_V6_vmpyiwub_acc_128B, "v62,v65,v66" },
2368 { Hexagon::BI__builtin_HEXAGON_V6_vmpyowh, "v60,v62,v65,v66" },
2369 { Hexagon::BI__builtin_HEXAGON_V6_vmpyowh_128B, "v60,v62,v65,v66" },
2370 { Hexagon::BI__builtin_HEXAGON_V6_vmpyowh_64_acc, "v62,v65,v66" },
2371 { Hexagon::BI__builtin_HEXAGON_V6_vmpyowh_64_acc_128B, "v62,v65,v66" },
2372 { Hexagon::BI__builtin_HEXAGON_V6_vmpyowh_rnd, "v60,v62,v65,v66" },
2373 { Hexagon::BI__builtin_HEXAGON_V6_vmpyowh_rnd_128B, "v60,v62,v65,v66" },
2374 { Hexagon::BI__builtin_HEXAGON_V6_vmpyowh_rnd_sacc, "v60,v62,v65,v66" },
2375 { Hexagon::BI__builtin_HEXAGON_V6_vmpyowh_rnd_sacc_128B, "v60,v62,v65,v66" },
2376 { Hexagon::BI__builtin_HEXAGON_V6_vmpyowh_sacc, "v60,v62,v65,v66" },
2377 { Hexagon::BI__builtin_HEXAGON_V6_vmpyowh_sacc_128B, "v60,v62,v65,v66" },
2378 { Hexagon::BI__builtin_HEXAGON_V6_vmpyub, "v60,v62,v65,v66" },
2379 { Hexagon::BI__builtin_HEXAGON_V6_vmpyub_128B, "v60,v62,v65,v66" },
2380 { Hexagon::BI__builtin_HEXAGON_V6_vmpyub_acc, "v60,v62,v65,v66" },
2381 { Hexagon::BI__builtin_HEXAGON_V6_vmpyub_acc_128B, "v60,v62,v65,v66" },
2382 { Hexagon::BI__builtin_HEXAGON_V6_vmpyubv, "v60,v62,v65,v66" },
2383 { Hexagon::BI__builtin_HEXAGON_V6_vmpyubv_128B, "v60,v62,v65,v66" },
2384 { Hexagon::BI__builtin_HEXAGON_V6_vmpyubv_acc, "v60,v62,v65,v66" },
2385 { Hexagon::BI__builtin_HEXAGON_V6_vmpyubv_acc_128B, "v60,v62,v65,v66" },
2386 { Hexagon::BI__builtin_HEXAGON_V6_vmpyuh, "v60,v62,v65,v66" },
2387 { Hexagon::BI__builtin_HEXAGON_V6_vmpyuh_128B, "v60,v62,v65,v66" },
2388 { Hexagon::BI__builtin_HEXAGON_V6_vmpyuh_acc, "v60,v62,v65,v66" },
2389 { Hexagon::BI__builtin_HEXAGON_V6_vmpyuh_acc_128B, "v60,v62,v65,v66" },
2390 { Hexagon::BI__builtin_HEXAGON_V6_vmpyuhe, "v65,v66" },
2391 { Hexagon::BI__builtin_HEXAGON_V6_vmpyuhe_128B, "v65,v66" },
2392 { Hexagon::BI__builtin_HEXAGON_V6_vmpyuhe_acc, "v65,v66" },
2393 { Hexagon::BI__builtin_HEXAGON_V6_vmpyuhe_acc_128B, "v65,v66" },
2394 { Hexagon::BI__builtin_HEXAGON_V6_vmpyuhv, "v60,v62,v65,v66" },
2395 { Hexagon::BI__builtin_HEXAGON_V6_vmpyuhv_128B, "v60,v62,v65,v66" },
2396 { Hexagon::BI__builtin_HEXAGON_V6_vmpyuhv_acc, "v60,v62,v65,v66" },
2397 { Hexagon::BI__builtin_HEXAGON_V6_vmpyuhv_acc_128B, "v60,v62,v65,v66" },
2398 { Hexagon::BI__builtin_HEXAGON_V6_vmux, "v60,v62,v65,v66" },
2399 { Hexagon::BI__builtin_HEXAGON_V6_vmux_128B, "v60,v62,v65,v66" },
2400 { Hexagon::BI__builtin_HEXAGON_V6_vnavgb, "v65,v66" },
2401 { Hexagon::BI__builtin_HEXAGON_V6_vnavgb_128B, "v65,v66" },
2402 { Hexagon::BI__builtin_HEXAGON_V6_vnavgh, "v60,v62,v65,v66" },
2403 { Hexagon::BI__builtin_HEXAGON_V6_vnavgh_128B, "v60,v62,v65,v66" },
2404 { Hexagon::BI__builtin_HEXAGON_V6_vnavgub, "v60,v62,v65,v66" },
2405 { Hexagon::BI__builtin_HEXAGON_V6_vnavgub_128B, "v60,v62,v65,v66" },
2406 { Hexagon::BI__builtin_HEXAGON_V6_vnavgw, "v60,v62,v65,v66" },
2407 { Hexagon::BI__builtin_HEXAGON_V6_vnavgw_128B, "v60,v62,v65,v66" },
2408 { Hexagon::BI__builtin_HEXAGON_V6_vnormamth, "v60,v62,v65,v66" },
2409 { Hexagon::BI__builtin_HEXAGON_V6_vnormamth_128B, "v60,v62,v65,v66" },
2410 { Hexagon::BI__builtin_HEXAGON_V6_vnormamtw, "v60,v62,v65,v66" },
2411 { Hexagon::BI__builtin_HEXAGON_V6_vnormamtw_128B, "v60,v62,v65,v66" },
2412 { Hexagon::BI__builtin_HEXAGON_V6_vnot, "v60,v62,v65,v66" },
2413 { Hexagon::BI__builtin_HEXAGON_V6_vnot_128B, "v60,v62,v65,v66" },
2414 { Hexagon::BI__builtin_HEXAGON_V6_vor, "v60,v62,v65,v66" },
2415 { Hexagon::BI__builtin_HEXAGON_V6_vor_128B, "v60,v62,v65,v66" },
2416 { Hexagon::BI__builtin_HEXAGON_V6_vpackeb, "v60,v62,v65,v66" },
2417 { Hexagon::BI__builtin_HEXAGON_V6_vpackeb_128B, "v60,v62,v65,v66" },
2418 { Hexagon::BI__builtin_HEXAGON_V6_vpackeh, "v60,v62,v65,v66" },
2419 { Hexagon::BI__builtin_HEXAGON_V6_vpackeh_128B, "v60,v62,v65,v66" },
2420 { Hexagon::BI__builtin_HEXAGON_V6_vpackhb_sat, "v60,v62,v65,v66" },
2421 { Hexagon::BI__builtin_HEXAGON_V6_vpackhb_sat_128B, "v60,v62,v65,v66" },
2422 { Hexagon::BI__builtin_HEXAGON_V6_vpackhub_sat, "v60,v62,v65,v66" },
2423 { Hexagon::BI__builtin_HEXAGON_V6_vpackhub_sat_128B, "v60,v62,v65,v66" },
2424 { Hexagon::BI__builtin_HEXAGON_V6_vpackob, "v60,v62,v65,v66" },
2425 { Hexagon::BI__builtin_HEXAGON_V6_vpackob_128B, "v60,v62,v65,v66" },
2426 { Hexagon::BI__builtin_HEXAGON_V6_vpackoh, "v60,v62,v65,v66" },
2427 { Hexagon::BI__builtin_HEXAGON_V6_vpackoh_128B, "v60,v62,v65,v66" },
2428 { Hexagon::BI__builtin_HEXAGON_V6_vpackwh_sat, "v60,v62,v65,v66" },
2429 { Hexagon::BI__builtin_HEXAGON_V6_vpackwh_sat_128B, "v60,v62,v65,v66" },
2430 { Hexagon::BI__builtin_HEXAGON_V6_vpackwuh_sat, "v60,v62,v65,v66" },
2431 { Hexagon::BI__builtin_HEXAGON_V6_vpackwuh_sat_128B, "v60,v62,v65,v66" },
2432 { Hexagon::BI__builtin_HEXAGON_V6_vpopcounth, "v60,v62,v65,v66" },
2433 { Hexagon::BI__builtin_HEXAGON_V6_vpopcounth_128B, "v60,v62,v65,v66" },
2434 { Hexagon::BI__builtin_HEXAGON_V6_vprefixqb, "v65,v66" },
2435 { Hexagon::BI__builtin_HEXAGON_V6_vprefixqb_128B, "v65,v66" },
2436 { Hexagon::BI__builtin_HEXAGON_V6_vprefixqh, "v65,v66" },
2437 { Hexagon::BI__builtin_HEXAGON_V6_vprefixqh_128B, "v65,v66" },
2438 { Hexagon::BI__builtin_HEXAGON_V6_vprefixqw, "v65,v66" },
2439 { Hexagon::BI__builtin_HEXAGON_V6_vprefixqw_128B, "v65,v66" },
2440 { Hexagon::BI__builtin_HEXAGON_V6_vrdelta, "v60,v62,v65,v66" },
2441 { Hexagon::BI__builtin_HEXAGON_V6_vrdelta_128B, "v60,v62,v65,v66" },
2442 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybub_rtt, "v65" },
2443 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybub_rtt_128B, "v65" },
2444 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybub_rtt_acc, "v65" },
2445 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybub_rtt_acc_128B, "v65" },
2446 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybus, "v60,v62,v65,v66" },
2447 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybus_128B, "v60,v62,v65,v66" },
2448 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybus_acc, "v60,v62,v65,v66" },
2449 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybus_acc_128B, "v60,v62,v65,v66" },
2450 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybusi, "v60,v62,v65,v66" },
2451 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybusi_128B, "v60,v62,v65,v66" },
2452 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybusi_acc, "v60,v62,v65,v66" },
2453 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybusi_acc_128B, "v60,v62,v65,v66" },
2454 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybusv, "v60,v62,v65,v66" },
2455 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybusv_128B, "v60,v62,v65,v66" },
2456 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybusv_acc, "v60,v62,v65,v66" },
2457 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybusv_acc_128B, "v60,v62,v65,v66" },
2458 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybv, "v60,v62,v65,v66" },
2459 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybv_128B, "v60,v62,v65,v66" },
2460 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybv_acc, "v60,v62,v65,v66" },
2461 { Hexagon::BI__builtin_HEXAGON_V6_vrmpybv_acc_128B, "v60,v62,v65,v66" },
2462 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyub, "v60,v62,v65,v66" },
2463 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyub_128B, "v60,v62,v65,v66" },
2464 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyub_acc, "v60,v62,v65,v66" },
2465 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyub_acc_128B, "v60,v62,v65,v66" },
2466 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyubi, "v60,v62,v65,v66" },
2467 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyubi_128B, "v60,v62,v65,v66" },
2468 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyubi_acc, "v60,v62,v65,v66" },
2469 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyubi_acc_128B, "v60,v62,v65,v66" },
2470 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyub_rtt, "v65" },
2471 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyub_rtt_128B, "v65" },
2472 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyub_rtt_acc, "v65" },
2473 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyub_rtt_acc_128B, "v65" },
2474 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyubv, "v60,v62,v65,v66" },
2475 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyubv_128B, "v60,v62,v65,v66" },
2476 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyubv_acc, "v60,v62,v65,v66" },
2477 { Hexagon::BI__builtin_HEXAGON_V6_vrmpyubv_acc_128B, "v60,v62,v65,v66" },
2478 { Hexagon::BI__builtin_HEXAGON_V6_vror, "v60,v62,v65,v66" },
2479 { Hexagon::BI__builtin_HEXAGON_V6_vror_128B, "v60,v62,v65,v66" },
2480 { Hexagon::BI__builtin_HEXAGON_V6_vrotr, "v66" },
2481 { Hexagon::BI__builtin_HEXAGON_V6_vrotr_128B, "v66" },
2482 { Hexagon::BI__builtin_HEXAGON_V6_vroundhb, "v60,v62,v65,v66" },
2483 { Hexagon::BI__builtin_HEXAGON_V6_vroundhb_128B, "v60,v62,v65,v66" },
2484 { Hexagon::BI__builtin_HEXAGON_V6_vroundhub, "v60,v62,v65,v66" },
2485 { Hexagon::BI__builtin_HEXAGON_V6_vroundhub_128B, "v60,v62,v65,v66" },
2486 { Hexagon::BI__builtin_HEXAGON_V6_vrounduhub, "v62,v65,v66" },
2487 { Hexagon::BI__builtin_HEXAGON_V6_vrounduhub_128B, "v62,v65,v66" },
2488 { Hexagon::BI__builtin_HEXAGON_V6_vrounduwuh, "v62,v65,v66" },
2489 { Hexagon::BI__builtin_HEXAGON_V6_vrounduwuh_128B, "v62,v65,v66" },
2490 { Hexagon::BI__builtin_HEXAGON_V6_vroundwh, "v60,v62,v65,v66" },
2491 { Hexagon::BI__builtin_HEXAGON_V6_vroundwh_128B, "v60,v62,v65,v66" },
2492 { Hexagon::BI__builtin_HEXAGON_V6_vroundwuh, "v60,v62,v65,v66" },
2493 { Hexagon::BI__builtin_HEXAGON_V6_vroundwuh_128B, "v60,v62,v65,v66" },