forked from llvm/clangir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CIR][Lowering] Add MLIR lowering support for CIR cos operations (llv…
…m#565) llvm#563 This PR add cir.cos lowering to MLIR math dialect, now it only surpport single and double float types, I add an assertation for the long double and other unimplemented types --------- Signed-off-by: zhoujing <jing.zhou@terapines.com>
- Loading branch information
1 parent
ecbd77e
commit ad22f54
Showing
2 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// RUN: cir-opt %s -cir-to-mlir -o %t.mlir | ||
// RUN: FileCheck %s --input-file %t.mlir | ||
|
||
module { | ||
cir.func @foo() { | ||
%1 = cir.const(#cir.fp<1.0> : !cir.float) : !cir.float | ||
%2 = cir.const(#cir.fp<1.0> : !cir.double) : !cir.double | ||
%3 = cir.cos %1 : !cir.float | ||
%4 = cir.cos %2 : !cir.double | ||
cir.return | ||
} | ||
} | ||
|
||
//CHECK: module { | ||
//CHECK: func.func @foo() { | ||
//CHECK: %cst = arith.constant 1.000000e+00 : f32 | ||
//CHECK: %cst_0 = arith.constant 1.000000e+00 : f64 | ||
//CHECK: %0 = math.cos %cst : f32 | ||
//CHECK: %1 = math.cos %cst_0 : f64 | ||
//CHECK: return | ||
//CHECK: } | ||
//CHECK: } |