Skip to content

Commit

Permalink
[CIR][LLVMLowering] Add LLVM lowering support for _Float16 (#716)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Lancern committed Jul 2, 2024
1 parent c8891bd commit a9eb565
Show file tree
Hide file tree
Showing 2 changed files with 655 additions and 2 deletions.
3 changes: 3 additions & 0 deletions clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3418,6 +3418,9 @@ void prepareTypeConverter(mlir::LLVMTypeConverter &converter,
converter.addConversion([&](mlir::cir::LongDoubleType type) -> mlir::Type {
return converter.convertType(type.getUnderlying());
});
converter.addConversion([&](mlir::cir::FP16Type type) -> mlir::Type {
return mlir::FloatType::getF16(type.getContext());
});
converter.addConversion([&](mlir::cir::FuncType type) -> mlir::Type {
auto result = converter.convertType(type.getReturnType());
llvm::SmallVector<mlir::Type> arguments;
Expand Down
Loading

0 comments on commit a9eb565

Please sign in to comment.