Skip to content

Commit 065b5ca

Browse files
Lancernsmeenai
authored andcommitted
[CIR][LLVMLowering] Add LLVM lowering support for _Float16 (llvm#716)
This PR adds LLVM lowering support for `_Float16` type. The only change we need to make here is adding a new type converter to the LLVM lowering pass. The majority of this PR is tests that check the generated LLVM IR. Later I'll add another separate PR that adds LLVM lowering support for the `__bf16` type. This PR is already big enough.
1 parent c211300 commit 065b5ca

File tree

2 files changed

+655
-2
lines changed

2 files changed

+655
-2
lines changed

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -3420,6 +3420,9 @@ void prepareTypeConverter(mlir::LLVMTypeConverter &converter,
34203420
converter.addConversion([&](mlir::cir::LongDoubleType type) -> mlir::Type {
34213421
return converter.convertType(type.getUnderlying());
34223422
});
3423+
converter.addConversion([&](mlir::cir::FP16Type type) -> mlir::Type {
3424+
return mlir::FloatType::getF16(type.getContext());
3425+
});
34233426
converter.addConversion([&](mlir::cir::FuncType type) -> mlir::Type {
34243427
auto result = converter.convertType(type.getReturnType());
34253428
llvm::SmallVector<mlir::Type> arguments;

0 commit comments

Comments
 (0)