File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
lib/CIR/Lowering/DirectToLLVM Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1049,6 +1049,10 @@ class CIRConstantLowering
1049
1049
typeConverter->convertType (op.getType ()),
1050
1050
op.getValue ().cast <mlir::cir::IntAttr>().getValue ());
1051
1051
} else if (op.getType ().isa <mlir::cir::FloatType>()) {
1052
+ // TODO(cir): ppcfp128 format floating-point type is lowered to the
1053
+ // llvm.ppc_fp128 type, which is not supported by mlir::FloatAttr. How to
1054
+ // lower a constant op with a value of such type to LLVMIR?
1055
+ assert (!op.getType ().cast <mlir::cir::FloatType>().isPpcFp128 () && " NYI" );
1052
1056
attr = rewriter.getFloatAttr (
1053
1057
typeConverter->convertType (op.getType ()),
1054
1058
op.getValue ().cast <mlir::cir::FloatAttr>().getValue ());
Original file line number Diff line number Diff line change
1
+ // RUN: cir-opt %s -cir-to-llvm -o %t.mlir
2
+ // RUN: FileCheck %s --input-file=%t.mlir
3
+
4
+ module {
5
+ cir.func @test() {
6
+ %0 = cir.const(#cir.float<1.0> : !cir.float<bin16>) : !cir.float<bin16>
7
+ // CHECK: %0 = llvm.mlir.constant(1.000000e+00 : f16) : f16
8
+ %1 = cir.const(#cir.float<1.0> : !cir.float<bin32>) : !cir.float<bin32>
9
+ // CHECK: %1 = llvm.mlir.constant(1.000000e+00 : f32) : f32
10
+ %2 = cir.const(#cir.float<1.0> : !cir.float<bin64>) : !cir.float<bin64>
11
+ // CHECK: %2 = llvm.mlir.constant(1.000000e+00 : f64) : f64
12
+ %3 = cir.const(#cir.float<1.0> : !cir.float<bin128>) : !cir.float<bin128>
13
+ // CHECK: %3 = llvm.mlir.constant(1.000000e+00 : f128) : f128
14
+ %4 = cir.const(#cir.float<1.0> : !cir.float<x86fp80>) : !cir.float<x86fp80>
15
+ // CHECK: %4 = llvm.mlir.constant(1.000000e+00 : f80) : f80
16
+ %5 = cir.const(#cir.float<1.0> : !cir.float<bf16>) : !cir.float<bf16>
17
+ // CHECK: %5 = llvm.mlir.constant(1.000000e+00 : bf16) : bf16
18
+ cir.return
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments