Skip to content

Commit

Permalink
Integrate LLVM at llvm/llvm-project@b214ca82daee
Browse files Browse the repository at this point in the history
Updates LLVM usage to match
[b214ca82daee](llvm/llvm-project@b214ca82daee)

PiperOrigin-RevId: 700689999
  • Loading branch information
d0k authored and copybara-github committed Nov 27, 2024
1 parent 6bf8972 commit 5024965
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions xls/contrib/mlir/transforms/arith_to_xls_patterns.td
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ def : FCmpPat<"ole", (Xls_CallDslxOp (FloatLib $lhs), CS<"lte_2">,
(variadic $lhs, $rhs), ConstUnitAttr)>;

// Define unordered(x, y) = is_nan(x + y)
def createDenormalIEEE : NativeCodeCall<
"::mlir::arith::DenormalModeAttr::get("
"$_builder.getContext(), ::mlir::arith::DenormalMode::ieee"
")">;
def : FCmpPat<"uno", (Xls_CallDslxOp (FloatLib $lhs), CS<"is_nan">,
(variadic (Arith_AddFOp $lhs, $rhs, $fmf)),
(variadic (Arith_AddFOp $lhs, $rhs, $fmf, (createDenormalIEEE))),
ConstUnitAttr)>;

def : BinaryOpOverflowPat<Arith_ShLIOp, Xls_ShllOp>;
Expand Down Expand Up @@ -119,7 +123,7 @@ defvar ExtLib = CS<"xls/contrib/mlir/stdlib/fp_ext_trunc.x">;

// Emits a binary float library call.
class FloatLibcall<Op Op, string Name> :
Pat<(Op:$op $a, $b, /*FastMathFlags=*/$_),
Pat<(Op:$op $a, $b, /*FastMathFlags=*/$_, /*denormal=*/$_),
(Xls_CallDslxOp (FloatLib $a), CS<Name>, (variadic $a, $b), ConstUnitAttr)>;

def : FloatLibcall<Arith_AddFOp, "add">;
Expand Down Expand Up @@ -177,7 +181,7 @@ class MinMaxPatBase<dag Matcher, dag Predicate> : Pat<
(createSelOp2Cases Predicate, $a, $b)>;

class FPMinMaxPat<Op Op, string Name> : MinMaxPatBase<
(Op:$op $a, $b, /*FastMathFlags=*/$_),
(Op:$op $a, $b, /*FastMathFlags=*/$_, /*denormal=*/$_),
(Xls_CallDslxOp (FloatLib $a), CS<Name>, (variadic $a, $b), ConstUnitAttr,
(returnType "boolLike(op)"))>;

Expand Down

0 comments on commit 5024965

Please sign in to comment.