Skip to content

Commit

Permalink
update clip to support fp64.
Browse files Browse the repository at this point in the history
Reviewed By: kunmingho

Differential Revision: D50943320
  • Loading branch information
jaybean-dev authored and facebook-github-bot committed Nov 14, 2023
1 parent 0f1ab96 commit c1137f4
Show file tree
Hide file tree
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
Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions lib/LLVMIRCodeGen/LLVMIRGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit c1137f4

Please sign in to comment.