clang 23.0.0git
CIRGenBuiltinAArch64.cpp File Reference
#include "CIRGenBuilder.h"
#include "CIRGenFunction.h"
#include "clang/Basic/TargetBuiltins.h"
#include "clang/CIR/MissingFeatures.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsAArch64.h"
#include "mlir/IR/Value.h"
#include "clang/AST/GlobalDecl.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/arm_sve_builtin_cg.inc"
#include "clang/Basic/arm_fp16.inc"
#include "clang/Basic/arm_neon.inc"

Go to the source code of this file.

Macros

#define NEONMAP0(NameBase)
#define NEONMAP1(NameBase, LLVMIntrinsic, TypeModifier)
#define NEONMAP2(NameBase, LLVMIntrinsic, AltLLVMIntrinsic, TypeModifier)
#define SVEMAP1(NameBase, LLVMIntrinsic, TypeModifier)
#define SVEMAP2(NameBase, TypeModifier)
#define GET_SVE_LLVM_INTRINSIC_MAP
#define GET_NEON_OVERLOAD_CHECK

Enumerations

enum  {
  AddRetType = (1 << 0) , Add1ArgType = (1 << 1) , Add2ArgTypes = (1 << 2) , VectorizeRetType = (1 << 3) ,
  VectorizeArgTypes = (1 << 4) , InventFloatType = (1 << 5) , UnsignedAlts = (1 << 6) , Use64BitVectors = (1 << 7) ,
  Use128BitVectors = (1 << 8) , Vectorize1ArgType = Add1ArgType | VectorizeArgTypes , VectorRet = AddRetType | VectorizeRetType , VectorRetGetArgs01 ,
  FpCmpzModifiers
}

Functions

static mlir::Value genVscaleTimesFactor (mlir::Location loc, CIRGenBuilderTy builder, mlir::Type cirTy, int32_t scalingFactor)
static const ARMVectorIntrinsicInfo * findARMVectorIntrinsicInMap (ArrayRef< ARMVectorIntrinsicInfo > intrinsicMap, unsigned builtinID, bool &mapProvenSorted)
static mlir::Value emitAArch64CompareBuiltinExpr (CIRGenFunction &cgf, CIRGenBuilderTy &builder, mlir::Location loc, mlir::Value src, mlir::Type retTy, const cir::CmpOpKind kind)
static cir::VectorType getNeonType (CIRGenFunction *cgf, NeonTypeFlags typeFlags, mlir::Location loc, bool hasLegalHalfType=true, bool v1Ty=false, bool allowBFloatArgsAndRet=true)
static mlir::Value emitCommonNeonBuiltinExpr (CIRGenFunction &cgf, unsigned builtinID, unsigned llvmIntrinsic, unsigned altLLVMIntrinsic, const char *nameHint, unsigned modifier, const CallExpr *expr, llvm::SmallVectorImpl< mlir::Value > &ops)
static mlir::Value emitCallMaybeConstrainedBuiltin (CIRGenBuilderTy &builder, mlir::Location loc, StringRef intrName, mlir::Type retTy, llvm::SmallVector< mlir::Value > &ops)
static llvm::StringRef getLLVMIntrNameNoPrefix (llvm::Intrinsic::ID intrID)
static unsigned getSVEMinEltCount (clang::SVETypeFlags::EltType sveType)
static cir::VectorType getSVEVectorForElementType (CIRGenModule &cgm, mlir::Type eltTy)
static bool hasExtraNeonArgument (unsigned builtinID)
 Return true if BuiltinID is an overloaded Neon intrinsic with an extra argument that specifies the vector type.
template<typename Operation>
static mlir::Value emitNeonCallToOp (CIRGenModule &cgm, CIRGenBuilderTy &builder, llvm::SmallVector< mlir::Type > argTypes, llvm::SmallVectorImpl< mlir::Value > &args, std::optional< llvm::StringRef > intrinsicName, mlir::Type funcResTy, mlir::Location loc, bool isConstrainedFPIntrinsic=false, unsigned shift=0, bool rightshift=false)
static mlir::Value emitNeonCall (CIRGenModule &cgm, CIRGenBuilderTy &builder, llvm::SmallVector< mlir::Type > argTypes, llvm::SmallVectorImpl< mlir::Value > &args, llvm::StringRef intrinsicName, mlir::Type funcResTy, mlir::Location loc, bool isConstrainedFPIntrinsic=false, unsigned shift=0, bool rightshift=false)

Variables

static const ARMVectorIntrinsicInfo AArch64SIMDIntrinsicMap []
static const ARMVectorIntrinsicInfo aarch64SVEIntrinsicMap []
static bool aarch64SIMDIntrinsicsProvenSorted = false
static bool aarch64SVEIntrinsicsProvenSorted = false
constexpr unsigned sveBitsPerBlock = 128
static const std::pair< unsigned, unsignedneonEquivalentIntrinsicMap []

Macro Definition Documentation

◆ GET_NEON_OVERLOAD_CHECK

#define GET_NEON_OVERLOAD_CHECK

◆ GET_SVE_LLVM_INTRINSIC_MAP

#define GET_SVE_LLVM_INTRINSIC_MAP

◆ NEONMAP0

#define NEONMAP0 ( NameBase)
Value:
{#NameBase, NEON::BI__builtin_neon_##NameBase, 0, 0, 0}

Definition at line 89 of file CIRGenBuiltinAArch64.cpp.

◆ NEONMAP1

#define NEONMAP1 ( NameBase,
LLVMIntrinsic,
TypeModifier )
Value:
{#NameBase, NEON::BI__builtin_neon_##NameBase, Intrinsic::LLVMIntrinsic, 0, \
TypeModifier}

Definition at line 92 of file CIRGenBuiltinAArch64.cpp.

◆ NEONMAP2

#define NEONMAP2 ( NameBase,
LLVMIntrinsic,
AltLLVMIntrinsic,
TypeModifier )
Value:
{#NameBase, NEON::BI__builtin_neon_##NameBase, Intrinsic::LLVMIntrinsic, \
Intrinsic::AltLLVMIntrinsic, TypeModifier}

Definition at line 96 of file CIRGenBuiltinAArch64.cpp.

◆ SVEMAP1

#define SVEMAP1 ( NameBase,
LLVMIntrinsic,
TypeModifier )
Value:
{#NameBase, SVE::BI__builtin_sve_##NameBase, Intrinsic::LLVMIntrinsic, 0, \
TypeModifier}

Definition at line 412 of file CIRGenBuiltinAArch64.cpp.

◆ SVEMAP2

#define SVEMAP2 ( NameBase,
TypeModifier )
Value:
{#NameBase, SVE::BI__builtin_sve_##NameBase, 0, 0, TypeModifier}

Definition at line 416 of file CIRGenBuiltinAArch64.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
AddRetType 
Add1ArgType 
Add2ArgTypes 
VectorizeRetType 
VectorizeArgTypes 
InventFloatType 
UnsignedAlts 
Use64BitVectors 
Use128BitVectors 
Vectorize1ArgType 
VectorRet 
VectorRetGetArgs01 
FpCmpzModifiers 

Definition at line 50 of file CIRGenBuiltinAArch64.cpp.

Function Documentation

◆ emitAArch64CompareBuiltinExpr()

◆ emitCallMaybeConstrainedBuiltin()

mlir::Value emitCallMaybeConstrainedBuiltin ( CIRGenBuilderTy & builder,
mlir::Location loc,
StringRef intrName,
mlir::Type retTy,
llvm::SmallVector< mlir::Value > & ops )
static

◆ emitCommonNeonBuiltinExpr()

◆ emitNeonCall()

mlir::Value emitNeonCall ( CIRGenModule & cgm,
CIRGenBuilderTy & builder,
llvm::SmallVector< mlir::Type > argTypes,
llvm::SmallVectorImpl< mlir::Value > & args,
llvm::StringRef intrinsicName,
mlir::Type funcResTy,
mlir::Location loc,
bool isConstrainedFPIntrinsic = false,
unsigned shift = 0,
bool rightshift = false )
static

◆ emitNeonCallToOp()

template<typename Operation>
mlir::Value emitNeonCallToOp ( CIRGenModule & cgm,
CIRGenBuilderTy & builder,
llvm::SmallVector< mlir::Type > argTypes,
llvm::SmallVectorImpl< mlir::Value > & args,
std::optional< llvm::StringRef > intrinsicName,
mlir::Type funcResTy,
mlir::Location loc,
bool isConstrainedFPIntrinsic = false,
unsigned shift = 0,
bool rightshift = false )
static

◆ findARMVectorIntrinsicInMap()

◆ genVscaleTimesFactor()

mlir::Value genVscaleTimesFactor ( mlir::Location loc,
CIRGenBuilderTy builder,
mlir::Type cirTy,
int32_t scalingFactor )
static

◆ getLLVMIntrNameNoPrefix()

llvm::StringRef getLLVMIntrNameNoPrefix ( llvm::Intrinsic::ID intrID)
static

◆ getNeonType()

◆ getSVEMinEltCount()

unsigned getSVEMinEltCount ( clang::SVETypeFlags::EltType sveType)
static

◆ getSVEVectorForElementType()

◆ hasExtraNeonArgument()

bool hasExtraNeonArgument ( unsigned builtinID)
static

Return true if BuiltinID is an overloaded Neon intrinsic with an extra argument that specifies the vector type.

The additional argument is meant for Sema checking (see CheckNeonBuiltinFunctionCall) and this function should be kept consistent with the logic in Sema. TODO: Make this return false for SISD builtins. TODO(cir): Share this with ARM.cpp

Definition at line 977 of file CIRGenBuiltinAArch64.cpp.

Referenced by clang::CIRGen::CIRGenFunction::emitAArch64BuiltinExpr().

Variable Documentation

◆ AArch64SIMDIntrinsicMap

const ARMVectorIntrinsicInfo AArch64SIMDIntrinsicMap[]
static

◆ aarch64SIMDIntrinsicsProvenSorted

bool aarch64SIMDIntrinsicsProvenSorted = false
static

◆ aarch64SVEIntrinsicMap

const ARMVectorIntrinsicInfo aarch64SVEIntrinsicMap[]
static
Initial value:
= {
#define GET_SVE_LLVM_INTRINSIC_MAP
}

Definition at line 418 of file CIRGenBuiltinAArch64.cpp.

Referenced by clang::CIRGen::CIRGenFunction::emitAArch64SVEBuiltinExpr().

◆ aarch64SVEIntrinsicsProvenSorted

bool aarch64SVEIntrinsicsProvenSorted = false
static

◆ neonEquivalentIntrinsicMap

const std::pair<unsigned, unsigned> neonEquivalentIntrinsicMap[]
static

◆ sveBitsPerBlock

unsigned sveBitsPerBlock = 128
constexpr

Definition at line 959 of file CIRGenBuiltinAArch64.cpp.

Referenced by getSVEVectorForElementType().