File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
lib/CIR/Lowering/ThroughMLIR
test/CIR/Lowering/ThroughMLIR Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -1401,6 +1401,15 @@ static mlir::TypeConverter prepareTypeConverter() {
14011401 converter.addConversion ([&](cir::LongDoubleType type) -> mlir::Type {
14021402 return converter.convertType (type.getUnderlying ());
14031403 });
1404+ converter.addConversion ([&](cir::FP128Type type) -> mlir::Type {
1405+ return mlir::FloatType::getF128 (type.getContext ());
1406+ });
1407+ converter.addConversion ([&](cir::FP16Type type) -> mlir::Type {
1408+ return mlir::FloatType::getF16 (type.getContext ());
1409+ });
1410+ converter.addConversion ([&](cir::BF16Type type) -> mlir::Type {
1411+ return mlir::FloatType::getBF16 (type.getContext ());
1412+ });
14041413 converter.addConversion ([&](cir::ArrayType type) -> mlir::Type {
14051414 SmallVector<int64_t > shape;
14061415 mlir::Type curType = type;
Original file line number Diff line number Diff line change 1+ // RUN: cir-opt %s -cir-to-mlir -o %t.mlir
2+ // RUN: FileCheck %s --input-file %t.mlir
3+
4+ module {
5+ cir.func @foo() {
6+ %0 = cir.const #cir.fp<1.0> : !cir.float
7+ %1 = cir.const #cir.fp<1.0> : !cir.double
8+ %2 = cir.const #cir.fp<1.0> : !cir.long_double<!cir.f80>
9+ %3 = cir.const #cir.fp<1.0> : !cir.f128
10+ %4 = cir.const #cir.fp<1.0> : !cir.f16
11+ %5 = cir.const #cir.fp<1.0> : !cir.bf16
12+ cir.return
13+ }
14+
15+ // CHECK-LABEL: @foo
16+ // CHECK: %{{.+}} = arith.constant 1.000000e+00 : f32
17+ // CHECK-NEXT: %{{.+}} = arith.constant 1.000000e+00 : f64
18+ // CHECK-NEXT: %{{.+}} = arith.constant 1.000000e+00 : f80
19+ // CHECK-NEXT: %{{.+}} = arith.constant 1.000000e+00 : f128
20+ // CHECK-NEXT: %{{.+}} = arith.constant 1.000000e+00 : f16
21+ // CHECK-NEXT: %{{.+}} = arith.constant 1.000000e+00 : bf16
22+ // CHECK: }
23+ }
You can’t perform that action at this time.
0 commit comments