mirror of
https://github.com/intel/llvm.git
synced 2026-02-01 08:56:15 +08:00
Exposed division and remainder operations in EDSC
This change introduces three new operators in EDSC: Div (also exposed via Expr.__div__ aka /) -- floating-point division, FloorDiv and CeilDiv for flooring/ceiling index division. The lowering to LLVM will be implemented in b/124872679. PiperOrigin-RevId: 234963217
This commit is contained in:
@@ -494,7 +494,10 @@ PYBIND11_MODULE(pybind, m) {
|
||||
DEFINE_PYBIND_BINARY_OP("Add", Add);
|
||||
DEFINE_PYBIND_BINARY_OP("Mul", Mul);
|
||||
DEFINE_PYBIND_BINARY_OP("Sub", Sub);
|
||||
// DEFINE_PYBIND_BINARY_OP("Div", Div);
|
||||
DEFINE_PYBIND_BINARY_OP("Div", Div);
|
||||
DEFINE_PYBIND_BINARY_OP("Rem", Rem);
|
||||
DEFINE_PYBIND_BINARY_OP("FloorDiv", FloorDiv);
|
||||
DEFINE_PYBIND_BINARY_OP("CeilDiv", CeilDiv);
|
||||
DEFINE_PYBIND_BINARY_OP("LT", LT);
|
||||
DEFINE_PYBIND_BINARY_OP("LE", LE);
|
||||
DEFINE_PYBIND_BINARY_OP("GT", GT);
|
||||
@@ -649,8 +652,14 @@ PYBIND11_MODULE(pybind, m) {
|
||||
PythonExpr e2) { return PythonExpr(::Sub(e1, e2)); })
|
||||
.def("__mul__", [](PythonExpr e1,
|
||||
PythonExpr e2) { return PythonExpr(::Mul(e1, e2)); })
|
||||
// .def("__div__", [](PythonExpr e1, PythonExpr e2) { return
|
||||
// PythonExpr(::Div(e1, e2)); })
|
||||
.def("__div__", [](PythonExpr e1,
|
||||
PythonExpr e2) { return PythonExpr(::Div(e1, e2)); })
|
||||
.def("__truediv__",
|
||||
[](PythonExpr e1, PythonExpr e2) {
|
||||
return PythonExpr(::Div(e1, e2));
|
||||
})
|
||||
.def("__mod__", [](PythonExpr e1,
|
||||
PythonExpr e2) { return PythonExpr(::Rem(e1, e2)); })
|
||||
.def("__lt__", [](PythonExpr e1,
|
||||
PythonExpr e2) { return PythonExpr(::LT(e1, e2)); })
|
||||
.def("__le__", [](PythonExpr e1,
|
||||
|
||||
Reference in New Issue
Block a user