Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update clip to support fp64.
Browse files Browse the repository at this point in the history
Differential Revision: D50943320
jaybean-dev authored and facebook-github-bot committed Nov 13, 2023
1 parent 0f1ab96 commit e525e94
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/glow/LLVMIRCodeGen/LLVMIRGen.h
Original file line number Diff line number Diff line change
@@ -216,6 +216,8 @@ class LLVMIRGen {
const glow::Value *val);
/// Generates LLVM IR that materializes the constant \p val.
llvm::Value *emitConstF32(llvm::IRBuilder<> &builder, float val);
/// Generates LLVM IR that materializes the constant double \p val.
llvm::Value *emitConstF64(llvm::IRBuilder<> &builder, double val);
/// Generates LLVM IR that materializes the constant int64 \p val.
llvm::Value *emitConstI64(llvm::IRBuilder<> &builder, int64_t val);
/// Generates LLVM IR that materializes the constant \p val.
7 changes: 7 additions & 0 deletions lib/LLVMIRCodeGen/LLVMIRGen.cpp
Original file line number Diff line number Diff line change
@@ -455,6 +455,9 @@ llvm::Type *LLVMIRGen::getLLVMPtrType(glow::ElemKind kind) {
case ElemKind::BoolTy:
T = llvm::Type::getInt8PtrTy(getLLVMContext());
break;
case ElemKind::Float64Ty:
T = llvm::Type::getDoubleTy(getLLVMContext());
break;
default:
LOG(FATAL) << "Unsupported element type: "
<< Type::getElementName(kind).str();
@@ -667,6 +670,10 @@ llvm::Value *LLVMIRGen::emitConstF32(llvm::IRBuilder<> &builder, float val) {
return llvm::ConstantFP::get(llvm::Type::getFloatTy(getLLVMContext()), val);
}

llvm::Value *LLVMIRGen::emitConstF64(llvm::IRBuilder<> &builder, double val) {
return llvm::ConstantFP::get(llvm::Type::getDoubleTy(getLLVMContext()), val);
}

llvm::Value *LLVMIRGen::emitConstI64(llvm::IRBuilder<> &builder, int64_t val) {
return builder.getInt64(val);
}

0 comments on commit e525e94

Please sign in to comment.