clang 23.0.0git
ARM.cpp File Reference
#include "ABIInfo.h"
#include "CGBuiltin.h"
#include "CGDebugInfo.h"
#include "TargetInfo.h"
#include "clang/Basic/AArch64CodeGenUtils.h"
#include "clang/Basic/TargetBuiltins.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/IntrinsicsAArch64.h"
#include "llvm/IR/IntrinsicsARM.h"
#include "llvm/IR/IntrinsicsBPF.h"
#include "llvm/TargetParser/AArch64TargetParser.h"
#include <numeric>
#include "clang/Basic/arm_sve_builtin_cg.inc"
#include "clang/Basic/BuiltinsAArch64NeonSVEBridge_cg.def"
#include "clang/Basic/arm_sme_builtin_cg.inc"
#include "clang/Basic/arm_fp16.inc"
#include "clang/Basic/arm_neon.inc"
#include "clang/Basic/arm_mve_builtin_cg.inc"
#include "clang/Basic/arm_cde_builtin_cg.inc"

Go to the source code of this file.

Macros

#define SVEMAP1(NameBase, LLVMIntrinsic, TypeModifier)
#define SVEMAP2(NameBase, TypeModifier)
#define GET_SVE_LLVM_INTRINSIC_MAP
#define SMEMAP1(NameBase, LLVMIntrinsic, TypeModifier)
#define SMEMAP2(NameBase, TypeModifier)
#define GET_SME_LLVM_INTRINSIC_MAP
#define GET_NEON_OVERLOAD_CHECK

Enumerations

enum  SpecialRegisterAccessKind { NormalRead , VolatileRead , Write }

Functions

static std::optional< CodeGenFunction::MSVCIntrintranslateAarch64ToMsvcIntrin (unsigned BuiltinID)
static std::optional< CodeGenFunction::MSVCIntrintranslateArmToMsvcIntrin (unsigned BuiltinID)
static ValueemitCallMaybeConstrainedFPBuiltin (CodeGenFunction &CGF, unsigned IntrinsicID, unsigned ConstrainedIntrinsicID, llvm::Type *Ty, ArrayRef< Value * > Args)
static llvm::FixedVectorType * GetNeonType (CodeGenFunction *CGF, NeonTypeFlags TypeFlags, bool HasFastHalfType=true, bool V1Ty=false, bool AllowBFloatArgsAndRet=true)
static llvm::VectorType * GetFloatNeonType (CodeGenFunction *CGF, NeonTypeFlags IntTypeFlags)
template<typename IntrinsicInfo>
static const IntrinsicInfo * findARMVectorIntrinsicInMap (ArrayRef< IntrinsicInfo > IntrinsicMap, unsigned BuiltinID, bool &MapProvenSorted)
static ValueEmitCommonNeonSISDBuiltinExpr (CodeGenFunction &CGF, const ARMNeonVectorIntrinsicInfo &SISDInfo, SmallVectorImpl< Value * > &Ops, const CallExpr *E)
static ValuepackTBLDVectorList (CodeGenFunction &CGF, ArrayRef< Value * > Ops, Value *ExtOp, Value *IndexOp, llvm::Type *ResTy, unsigned IntID, const char *Name)
static ValueEmitSpecialRegisterBuiltin (CodeGenFunction &CGF, const CallExpr *E, llvm::Type *RegisterType, llvm::Type *ValueType, SpecialRegisterAccessKind AccessKind, StringRef SysReg="")
static ValueEmitRangePrefetchBuiltin (CodeGenFunction &CGF, unsigned BuiltinID, const CallExpr *E)
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 Integer>
static Integer GetIntegerConstantValue (const Expr *E, ASTContext &Context)
static llvm::ValueSignOrZeroExtend (CGBuilderTy &Builder, llvm::Value *V, llvm::Type *T, bool Unsigned)
static llvm::ValueMVEImmediateShr (CGBuilderTy &Builder, llvm::Value *V, uint32_t Shift, bool Unsigned)
static llvm::ValueARMMVEVectorSplat (CGBuilderTy &Builder, llvm::Value *V)
static llvm::ValueARMMVEVectorReinterpret (CGBuilderTy &Builder, CodeGenFunction *CGF, llvm::Value *V, llvm::Type *DestType)
static llvm::ValueVectorUnzip (CGBuilderTy &Builder, llvm::Value *V, bool Odd)
static llvm::ValueVectorZip (CGBuilderTy &Builder, llvm::Value *V0, llvm::Value *V1)
template<unsigned HighBit, unsigned OtherBits>
static llvm::ValueARMMVEConstantSplat (CGBuilderTy &Builder, llvm::Type *VT)
static llvm::ValueARMMVEVectorElementReverse (CGBuilderTy &Builder, llvm::Value *V, unsigned ReverseWidth)
static llvm::ValueARMMVECreateSIToFP (CGBuilderTy &Builder, CodeGenFunction *CGF, llvm::Value *V, llvm::Type *Ty)
static llvm::ValueARMMVECreateUIToFP (CGBuilderTy &Builder, CodeGenFunction *CGF, llvm::Value *V, llvm::Type *Ty)
static llvm::ValueARMMVECreateFPToSI (CGBuilderTy &Builder, CodeGenFunction *CGF, llvm::Value *V, llvm::Type *Ty)
static llvm::ValueARMMVECreateFPToUI (CGBuilderTy &Builder, CodeGenFunction *CGF, llvm::Value *V, llvm::Type *Ty)
static ValueEmitAArch64TblBuiltinExpr (CodeGenFunction &CGF, unsigned BuiltinID, const CallExpr *E, SmallVectorImpl< Value * > &Ops, llvm::Triple::ArchType Arch)
static llvm::ScalableVectorType * getSVEVectorForElementType (llvm::Type *EltTy)
static void InsertExplicitZeroOperand (CGBuilderTy &Builder, llvm::Type *Ty, SmallVectorImpl< Value * > &Ops)
static void InsertExplicitUndefOperand (CGBuilderTy &Builder, llvm::Type *Ty, SmallVectorImpl< Value * > &Ops)
static void swapCommutativeSMEOperands (unsigned BuiltinID, SmallVectorImpl< Value * > &Ops)
ValuereadX18AsPtr (CodeGenFunction &CGF)
 Helper for the read/write/add/inc X18 builtins: read the X18 register and return it as an i8 pointer.

Variables

static const ARMNeonVectorIntrinsicInfo ARMSIMDIntrinsicMap []
static const std::pair< unsigned, unsignedNEONEquivalentIntrinsicMap []
static const AArch64SVEAndSMEVectorIntrinsicInfo AArch64SVEIntrinsicMap []
static const AArch64SVEAndSMEVectorIntrinsicInfo AArch64SMEIntrinsicMap []
static bool NEONSIMDIntrinsicsProvenSorted = false
static bool AArch64SIMDIntrinsicsProvenSorted = false
static bool AArch64SISDIntrinsicsProvenSorted = false
static bool AArch64SVEIntrinsicsProvenSorted = false
static bool AArch64SMEIntrinsicsProvenSorted = false
constexpr unsigned SVEBitsPerBlock = 128

Macro Definition Documentation

◆ GET_NEON_OVERLOAD_CHECK

#define GET_NEON_OVERLOAD_CHECK

◆ GET_SME_LLVM_INTRINSIC_MAP

#define GET_SME_LLVM_INTRINSIC_MAP

◆ GET_SVE_LLVM_INTRINSIC_MAP

#define GET_SVE_LLVM_INTRINSIC_MAP

◆ SMEMAP1

#define SMEMAP1 ( NameBase,
LLVMIntrinsic,
TypeModifier )
Value:
{SME::BI__builtin_sme_##NameBase, Intrinsic::LLVMIntrinsic, TypeModifier}

Definition at line 969 of file ARM.cpp.

◆ SMEMAP2

#define SMEMAP2 ( NameBase,
TypeModifier )
Value:
{SME::BI__builtin_sme_##NameBase, 0, TypeModifier}

Definition at line 972 of file ARM.cpp.

◆ SVEMAP1

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

Definition at line 954 of file ARM.cpp.

◆ SVEMAP2

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

Definition at line 957 of file ARM.cpp.

Enumeration Type Documentation

◆ SpecialRegisterAccessKind

Enumerator
NormalRead 
VolatileRead 
Write 

Definition at line 1943 of file ARM.cpp.

Function Documentation

◆ ARMMVEConstantSplat()

template<unsigned HighBit, unsigned OtherBits>
llvm::Value * ARMMVEConstantSplat ( CGBuilderTy & Builder,
llvm::Type * VT )
static

Definition at line 2884 of file ARM.cpp.

References ARMMVEVectorSplat(), clang::cast(), and uint32_t.

◆ ARMMVECreateFPToSI()

llvm::Value * ARMMVECreateFPToSI ( CGBuilderTy & Builder,
CodeGenFunction * CGF,
llvm::Value * V,
llvm::Type * Ty )
static

◆ ARMMVECreateFPToUI()

llvm::Value * ARMMVECreateFPToUI ( CGBuilderTy & Builder,
CodeGenFunction * CGF,
llvm::Value * V,
llvm::Type * Ty )
static

◆ ARMMVECreateSIToFP()

llvm::Value * ARMMVECreateSIToFP ( CGBuilderTy & Builder,
CodeGenFunction * CGF,
llvm::Value * V,
llvm::Type * Ty )
static

◆ ARMMVECreateUIToFP()

llvm::Value * ARMMVECreateUIToFP ( CGBuilderTy & Builder,
CodeGenFunction * CGF,
llvm::Value * V,
llvm::Type * Ty )
static

◆ ARMMVEVectorElementReverse()

llvm::Value * ARMMVEVectorElementReverse ( CGBuilderTy & Builder,
llvm::Value * V,
unsigned ReverseWidth )
static

Definition at line 2896 of file ARM.cpp.

References V.

◆ ARMMVEVectorReinterpret()

◆ ARMMVEVectorSplat()

llvm::Value * ARMMVEVectorSplat ( CGBuilderTy & Builder,
llvm::Value * V )
static

Definition at line 2824 of file ARM.cpp.

References V.

Referenced by ARMMVEConstantSplat().

◆ EmitAArch64TblBuiltinExpr()

◆ emitCallMaybeConstrainedFPBuiltin()

Value * emitCallMaybeConstrainedFPBuiltin ( CodeGenFunction & CGF,
unsigned IntrinsicID,
unsigned ConstrainedIntrinsicID,
llvm::Type * Ty,
ArrayRef< Value * > Args )
static

◆ EmitCommonNeonSISDBuiltinExpr()

◆ EmitRangePrefetchBuiltin()

◆ EmitSpecialRegisterBuiltin()

◆ findARMVectorIntrinsicInMap()

template<typename IntrinsicInfo>
const IntrinsicInfo * findARMVectorIntrinsicInMap ( ArrayRef< IntrinsicInfo > IntrinsicMap,
unsigned BuiltinID,
bool & MapProvenSorted )
static

Definition at line 994 of file ARM.cpp.

◆ GetFloatNeonType()

◆ GetIntegerConstantValue()

template<typename Integer>
Integer GetIntegerConstantValue ( const Expr * E,
ASTContext & Context )
static

Definition at line 2791 of file ARM.cpp.

References clang::Expr::getIntegerConstantExpr(), and Integer.

◆ GetNeonType()

◆ getSVEVectorForElementType()

llvm::ScalableVectorType * getSVEVectorForElementType ( llvm::Type * EltTy)
static

Definition at line 3336 of file ARM.cpp.

References SVEBitsPerBlock.

◆ 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.

Definition at line 2073 of file ARM.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitAArch64BuiltinExpr(), and clang::CodeGen::CodeGenFunction::EmitARMBuiltinExpr().

◆ InsertExplicitUndefOperand()

void InsertExplicitUndefOperand ( CGBuilderTy & Builder,
llvm::Type * Ty,
SmallVectorImpl< Value * > & Ops )
static

◆ InsertExplicitZeroOperand()

void InsertExplicitZeroOperand ( CGBuilderTy & Builder,
llvm::Type * Ty,
SmallVectorImpl< Value * > & Ops )
static

◆ MVEImmediateShr()

llvm::Value * MVEImmediateShr ( CGBuilderTy & Builder,
llvm::Value * V,
uint32_t Shift,
bool Unsigned )
static

Definition at line 2802 of file ARM.cpp.

References clang::cast(), uint32_t, clang::Unsigned, and V.

◆ packTBLDVectorList()

Value * packTBLDVectorList ( CodeGenFunction & CGF,
ArrayRef< Value * > Ops,
Value * ExtOp,
Value * IndexOp,
llvm::Type * ResTy,
unsigned IntID,
const char * Name )
static

◆ readX18AsPtr()

◆ SignOrZeroExtend()

llvm::Value * SignOrZeroExtend ( CGBuilderTy & Builder,
llvm::Value * V,
llvm::Type * T,
bool Unsigned )
static

Definition at line 2795 of file ARM.cpp.

References clang::Unsigned, and V.

◆ swapCommutativeSMEOperands()

void swapCommutativeSMEOperands ( unsigned BuiltinID,
SmallVectorImpl< Value * > & Ops )
static

◆ translateAarch64ToMsvcIntrin()

std::optional< CodeGenFunction::MSVCIntrin > translateAarch64ToMsvcIntrin ( unsigned BuiltinID)
static

Definition at line 33 of file ARM.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitAArch64BuiltinExpr().

◆ translateArmToMsvcIntrin()

std::optional< CodeGenFunction::MSVCIntrin > translateArmToMsvcIntrin ( unsigned BuiltinID)
static

Definition at line 192 of file ARM.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitARMBuiltinExpr().

◆ VectorUnzip()

llvm::Value * VectorUnzip ( CGBuilderTy & Builder,
llvm::Value * V,
bool Odd )
static

Definition at line 2858 of file ARM.cpp.

References clang::cast(), and V.

◆ VectorZip()

llvm::Value * VectorZip ( CGBuilderTy & Builder,
llvm::Value * V0,
llvm::Value * V1 )
static

Definition at line 2869 of file ARM.cpp.

References clang::cast().

Variable Documentation

◆ AArch64SIMDIntrinsicsProvenSorted

bool AArch64SIMDIntrinsicsProvenSorted = false
static

Definition at line 985 of file ARM.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitAArch64BuiltinExpr().

◆ AArch64SISDIntrinsicsProvenSorted

bool AArch64SISDIntrinsicsProvenSorted = false
static

Definition at line 986 of file ARM.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitAArch64BuiltinExpr().

◆ AArch64SMEIntrinsicMap

const AArch64SVEAndSMEVectorIntrinsicInfo AArch64SMEIntrinsicMap[]
static
Initial value:
= {
#define GET_SME_LLVM_INTRINSIC_MAP
}

Definition at line 974 of file ARM.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitAArch64SMEBuiltinExpr().

◆ AArch64SMEIntrinsicsProvenSorted

bool AArch64SMEIntrinsicsProvenSorted = false
static

Definition at line 988 of file ARM.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitAArch64SMEBuiltinExpr().

◆ AArch64SVEIntrinsicMap

const AArch64SVEAndSMEVectorIntrinsicInfo AArch64SVEIntrinsicMap[]
static
Initial value:
= {
#define GET_SVE_LLVM_INTRINSIC_MAP
}

Definition at line 959 of file ARM.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitAArch64SVEBuiltinExpr().

◆ AArch64SVEIntrinsicsProvenSorted

bool AArch64SVEIntrinsicsProvenSorted = false
static

Definition at line 987 of file ARM.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitAArch64SVEBuiltinExpr().

◆ ARMSIMDIntrinsicMap

const ARMNeonVectorIntrinsicInfo ARMSIMDIntrinsicMap[]
static

Definition at line 540 of file ARM.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitARMBuiltinExpr().

◆ NEONEquivalentIntrinsicMap

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

◆ NEONSIMDIntrinsicsProvenSorted

bool NEONSIMDIntrinsicsProvenSorted = false
static

Definition at line 983 of file ARM.cpp.

Referenced by clang::CodeGen::CodeGenFunction::EmitARMBuiltinExpr().

◆ SVEBitsPerBlock

unsigned SVEBitsPerBlock = 128
constexpr