Skip to content

Commit 89bf895

Browse files
authored
[CIR][LLVMLowering] Add LLVM lowering for __bf16 (#717)
This PR adds LLVM lowering support for the `__bf16` type. To support its LLVM lowering, we just need to add a new type conversion rule to the LLVM lowering pass. The majority of this PR are the new LLVM IR checks in the tests.
1 parent 05f3834 commit 89bf895

File tree

2 files changed

+659
-2
lines changed

2 files changed

+659
-2
lines changed

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

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

0 commit comments

Comments
 (0)