[PATCH] D79455: [mlir][StandardToLLVM] Add support for lowering FPToSIOp to LLVM.
Han-Chung Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 5 16:45:18 PDT 2020
hanchung created this revision.
hanchung added reviewers: rriddle, asaadaldien.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, Joonsoo, stephenneuendorffer, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, jpienaar, mehdi_amini.
Herald added a reviewer: ftynse.
Herald added a project: LLVM.
Depends On D79374 <https://reviews.llvm.org/D79374>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79455
Files:
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
Index: mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
===================================================================
--- mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
+++ mlir/test/Conversion/StandardToLLVM/convert-to-llvmir.mlir
@@ -552,6 +552,20 @@
return
}
+// Checking conversion of floating point to integer types.
+// CHECK-LABEL: @fptosi
+func @fptosi(%arg0 : f32, %arg1 : f64) {
+// CHECK-NEXT: = llvm.fptosi {{.*}} : !llvm.float to !llvm.i32
+ %0 = fptosi %arg0: f32 to i32
+// CHECK-NEXT: = llvm.fptosi {{.*}} : !llvm.float to !llvm.i64
+ %1 = fptosi %arg0: f32 to i64
+// CHECK-NEXT: = llvm.fptosi {{.*}} : !llvm.double to !llvm.i32
+ %2 = fptosi %arg1: f64 to i32
+// CHECK-NEXT: = llvm.fptosi {{.*}} : !llvm.double to !llvm.i64
+ %3 = fptosi %arg1: f64 to i64
+ return
+}
+
// Checking conversion of integer types to floating point.
// CHECK-LABEL: @fptrunc
func @fptrunc(%arg0 : f32, %arg1 : f64) {
Index: mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
===================================================================
--- mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
+++ mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
@@ -2128,6 +2128,11 @@
using Super::Super;
};
+struct FPToSILowering
+ : public OneToOneConvertToLLVMPattern<FPToSIOp, LLVM::FPToSIOp> {
+ using Super::Super;
+};
+
struct FPTruncLowering
: public OneToOneConvertToLLVMPattern<FPTruncOp, LLVM::FPTruncOp> {
using Super::Super;
@@ -2905,6 +2910,7 @@
Log10OpLowering,
Log2OpLowering,
FPExtLowering,
+ FPToSILowering,
FPTruncLowering,
IndexCastOpLowering,
MulFOpLowering,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79455.262259.patch
Type: text/x-patch
Size: 1686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200505/4767b16a/attachment.bin>
More information about the llvm-commits
mailing list