Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit 0cd8aae

Browse files
Jay Banerjeefacebook-github-bot
authored andcommitted
update clip to support fp64.
Reviewed By: jfix71, kunmingho Differential Revision: D50943320 fbshipit-source-id: 8fdefafc2896d9b1d0010c6d613f53cf12f16c6c
1 parent 0f1ab96 commit 0cd8aae

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/glow/LLVMIRCodeGen/LLVMIRGen.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ class LLVMIRGen {
216216
const glow::Value *val);
217217
/// Generates LLVM IR that materializes the constant \p val.
218218
llvm::Value *emitConstF32(llvm::IRBuilder<> &builder, float val);
219+
/// Generates LLVM IR that materializes the constant double \p val.
220+
llvm::Value *emitConstF64(llvm::IRBuilder<> &builder, double val);
219221
/// Generates LLVM IR that materializes the constant int64 \p val.
220222
llvm::Value *emitConstI64(llvm::IRBuilder<> &builder, int64_t val);
221223
/// Generates LLVM IR that materializes the constant \p val.

lib/LLVMIRCodeGen/LLVMIRGen.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,9 @@ llvm::Type *LLVMIRGen::getLLVMPtrType(glow::ElemKind kind) {
455455
case ElemKind::BoolTy:
456456
T = llvm::Type::getInt8PtrTy(getLLVMContext());
457457
break;
458+
case ElemKind::Float64Ty:
459+
T = llvm::Type::getDoubleTy(getLLVMContext());
460+
break;
458461
default:
459462
LOG(FATAL) << "Unsupported element type: "
460463
<< Type::getElementName(kind).str();
@@ -667,6 +670,10 @@ llvm::Value *LLVMIRGen::emitConstF32(llvm::IRBuilder<> &builder, float val) {
667670
return llvm::ConstantFP::get(llvm::Type::getFloatTy(getLLVMContext()), val);
668671
}
669672

673+
llvm::Value *LLVMIRGen::emitConstF64(llvm::IRBuilder<> &builder, double val) {
674+
return llvm::ConstantFP::get(llvm::Type::getDoubleTy(getLLVMContext()), val);
675+
}
676+
670677
llvm::Value *LLVMIRGen::emitConstI64(llvm::IRBuilder<> &builder, int64_t val) {
671678
return builder.getInt64(val);
672679
}

0 commit comments

Comments
 (0)