[llvm-branch-commits] [mlir] c77ea40 - [mlir] Add std.pow lowering to LLVMIR

Tres Popp via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 15 09:58:42 PST 2020


Author: Tres Popp
Date: 2020-12-15T18:54:29+01:00
New Revision: c77ea40528de7d5bf74b19819b82eeb0e5dab89d

URL: https://github.com/llvm/llvm-project/commit/c77ea40528de7d5bf74b19819b82eeb0e5dab89d
DIFF: https://github.com/llvm/llvm-project/commit/c77ea40528de7d5bf74b19819b82eeb0e5dab89d.diff

LOG: [mlir] Add std.pow lowering to LLVMIR

Differential Revision: https://reviews.llvm.org/D93311

Added: 
    

Modified: 
    mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
    mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
index 939bc7d50e27..f30048186a0b 100644
--- a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
+++ b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
@@ -1681,6 +1681,7 @@ using MulFOpLowering = VectorConvertToLLVMPattern<MulFOp, LLVM::FMulOp>;
 using MulIOpLowering = VectorConvertToLLVMPattern<MulIOp, LLVM::MulOp>;
 using NegFOpLowering = VectorConvertToLLVMPattern<NegFOp, LLVM::FNegOp>;
 using OrOpLowering = VectorConvertToLLVMPattern<OrOp, LLVM::OrOp>;
+using PowFOpLowering = VectorConvertToLLVMPattern<PowFOp, LLVM::PowOp>;
 using RemFOpLowering = VectorConvertToLLVMPattern<RemFOp, LLVM::FRemOp>;
 using SelectOpLowering = OneToOneConvertToLLVMPattern<SelectOp, LLVM::SelectOp>;
 using ShiftLeftOpLowering =
@@ -3963,6 +3964,7 @@ void mlir::populateStdToLLVMNonMemoryConversionPatterns(
       MulIOpLowering,
       NegFOpLowering,
       OrOpLowering,
+      PowFOpLowering,
       PrefetchOpLowering,
       ReOpLowering,
       RemFOpLowering,

diff  --git a/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir b/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir
index 9c709a653b27..acb894af1f38 100644
--- a/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir
+++ b/mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir
@@ -213,3 +213,13 @@ func @call_zero_result_func() {
   return
 }
 func private @zero_result_func()
+
+// -----
+
+// CHECK-LABEL: func @powf(
+// CHECK-SAME: !llvm.double
+func @powf(%arg0 : f64) {
+  // CHECK: %[[POWF:.*]] = "llvm.intr.pow"(%arg0, %arg0) : (!llvm.double, !llvm.double) -> !llvm.double
+  %0 = std.powf %arg0, %arg0 : f64
+  std.return
+}


        


More information about the llvm-branch-commits mailing list