[PATCH] D80248: Added pow intrinsic to LLVMIR dialect

George Mitenkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 19 14:53:50 PDT 2020


georgemitenkov created this revision.
georgemitenkov added reviewers: antiagainst, mravishankar, ftynse.
Herald added subscribers: llvm-commits, jurahul, Kayjukh, frgossen, grosul1, Joonsoo, stephenneuendorffer, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, shauheen, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.

Added pow intrinsic to LLVMIR dialect. Added a roundrip test for it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80248

Files:
  mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
  mlir/test/Dialect/LLVMIR/roundtrip.mlir


Index: mlir/test/Dialect/LLVMIR/roundtrip.mlir
===================================================================
--- mlir/test/Dialect/LLVMIR/roundtrip.mlir
+++ mlir/test/Dialect/LLVMIR/roundtrip.mlir
@@ -100,6 +100,11 @@
 // CHECK: "llvm.intr.sin"(%arg1) : (!llvm.float) -> !llvm.float
   %30 = "llvm.intr.sin"(%arg1) : (!llvm.float) -> !llvm.float
 
+// CHECK:       %31 = llvm.mlir.constant(4.200000e+00 : f32) : !llvm.float
+// CHECK-NEXT:  %32 = "llvm.intr.pow"(%arg1, %31) : (!llvm.float, !llvm.float) -> !llvm.float
+  %31 = llvm.mlir.constant(4.200000e+00 : f32) : !llvm.float
+  %32 = "llvm.intr.pow"(%arg1, %31) : (!llvm.float, !llvm.float) -> !llvm.float
+
 // CHECK:  llvm.return
   llvm.return
 }
Index: mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
===================================================================
--- mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -790,6 +790,7 @@
                                LLVM_Type:$hint, LLVM_Type:$cache)>;
 def LLVM_SinOp : LLVM_UnaryIntrinsicOp<"sin">;
 def LLVM_SqrtOp : LLVM_UnaryIntrinsicOp<"sqrt">;
+def LLVM_PowOp : LLVM_BinarySameArgsIntrinsicOp<"pow">;
 
 //
 // Vector Reductions.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80248.265047.patch
Type: text/x-patch
Size: 1200 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200519/c8e5bd14/attachment.bin>


More information about the llvm-commits mailing list