Skip to content

Commit

Permalink
Add parentheses in IRMatch.h
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreinking committed Dec 29, 2024
1 parent b308a0e commit 69ecb43
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions src/IRMatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -648,14 +648,14 @@ struct BinOp {
}
const Op &op = (const Op &)e;
return (a.template match<bound>(*op.a.get(), state) &&
b.template match < bound | bindings<A>::mask > (*op.b.get(), state));
b.template match<(bound | bindings<A>::mask)>(*op.b.get(), state));
}

template<uint32_t bound, typename Op2, typename A2, typename B2>
HALIDE_ALWAYS_INLINE bool match(const BinOp<Op2, A2, B2> &op, MatcherState &state) const noexcept {
return (std::is_same<Op, Op2>::value &&
a.template match<bound>(unwrap(op.a), state) &&
b.template match < bound | bindings<A>::mask > (unwrap(op.b), state));
b.template match<(bound | bindings<A>::mask)>(unwrap(op.b), state));
}

constexpr static bool foldable = A::foldable && B::foldable;
Expand Down Expand Up @@ -750,14 +750,14 @@ struct CmpOp {
}
const Op &op = (const Op &)e;
return (a.template match<bound>(*op.a.get(), state) &&
b.template match < bound | bindings<A>::mask > (*op.b.get(), state));
b.template match<(bound | bindings<A>::mask)>(*op.b.get(), state));
}

template<uint32_t bound, typename Op2, typename A2, typename B2>
HALIDE_ALWAYS_INLINE bool match(const CmpOp<Op2, A2, B2> &op, MatcherState &state) const noexcept {
return (std::is_same<Op, Op2>::value &&
a.template match<bound>(unwrap(op.a), state) &&
b.template match < bound | bindings<A>::mask > (unwrap(op.b), state));
b.template match<(bound | bindings<A>::mask)>(unwrap(op.b), state));
}

constexpr static bool foldable = A::foldable && B::foldable;
Expand Down Expand Up @@ -1357,8 +1357,7 @@ struct Intrin {
HALIDE_ALWAYS_INLINE bool match_args(int, const Call &c, MatcherState &state) const noexcept {
using T = decltype(std::get<i>(args));
return (std::get<i>(args).template match<bound>(*c.args[i].get(), state) &&
match_args < i + 1,
bound | bindings<T>::mask > (0, c, state));
match_args<i + 1, (bound | bindings<T>::mask)>(0, c, state));
}

template<int i, uint32_t binds>
Expand Down Expand Up @@ -1688,14 +1687,14 @@ struct SelectOp {
}
const Select &op = (const Select &)e;
return (c.template match<bound>(*op.condition.get(), state) &&
t.template match < bound | bindings<C>::mask > (*op.true_value.get(), state) &&
f.template match < bound | bindings<C>::mask | bindings<T>::mask > (*op.false_value.get(), state));
t.template match<(bound | bindings<C>::mask)>(*op.true_value.get(), state) &&
f.template match<(bound | bindings<C>::mask | bindings<T>::mask)>(*op.false_value.get(), state));
}
template<uint32_t bound, typename C2, typename T2, typename F2>
HALIDE_ALWAYS_INLINE bool match(const SelectOp<C2, T2, F2> &instance, MatcherState &state) const noexcept {
return (c.template match<bound>(unwrap(instance.c), state) &&
t.template match < bound | bindings<C>::mask > (unwrap(instance.t), state) &&
f.template match < bound | bindings<C>::mask | bindings<T>::mask > (unwrap(instance.f), state));
t.template match<(bound | bindings<C>::mask)>(unwrap(instance.t), state) &&
f.template match<(bound | bindings<C>::mask | bindings<T>::mask)>(unwrap(instance.f), state));
}

HALIDE_ALWAYS_INLINE
Expand Down Expand Up @@ -1761,7 +1760,7 @@ struct BroadcastOp {
template<uint32_t bound, typename A2, typename B2>
HALIDE_ALWAYS_INLINE bool match(const BroadcastOp<A2, B2> &op, MatcherState &state) const noexcept {
return (a.template match<bound>(unwrap(op.a), state) &&
lanes.template match < bound | bindings<A>::mask > (unwrap(op.lanes), state));
lanes.template match<(bound | bindings<A>::mask)>(unwrap(op.lanes), state));
}

HALIDE_ALWAYS_INLINE
Expand Down Expand Up @@ -1825,8 +1824,8 @@ struct RampOp {
}
const Ramp &op = (const Ramp &)e;
if (a.template match<bound>(*op.base.get(), state) &&
b.template match < bound | bindings<A>::mask > (*op.stride.get(), state) &&
lanes.template match < bound | bindings<A>::mask | bindings<B>::mask > (op.lanes, state)) {
b.template match<(bound | bindings<A>::mask)>(*op.stride.get(), state) &&
lanes.template match<(bound | bindings<A>::mask | bindings<B>::mask)>(op.lanes, state)) {
return true;
} else {
return false;
Expand All @@ -1836,8 +1835,8 @@ struct RampOp {
template<uint32_t bound, typename A2, typename B2, typename C2>
HALIDE_ALWAYS_INLINE bool match(const RampOp<A2, B2, C2> &op, MatcherState &state) const noexcept {
return (a.template match<bound>(unwrap(op.a), state) &&
b.template match < bound | bindings<A>::mask > (unwrap(op.b), state) &&
lanes.template match < bound | bindings<A>::mask | bindings<B>::mask > (unwrap(op.lanes), state));
b.template match<(bound | bindings<A>::mask)>(unwrap(op.b), state) &&
lanes.template match<(bound | bindings<A>::mask | bindings<B>::mask)>(unwrap(op.lanes), state));
}

HALIDE_ALWAYS_INLINE
Expand Down Expand Up @@ -1888,7 +1887,7 @@ struct VectorReduceOp {
const VectorReduce &op = (const VectorReduce &)e;
if (op.op == reduce_op &&
a.template match<bound>(*op.value.get(), state) &&
lanes.template match < bound | bindings<A>::mask > (op.type.lanes(), state)) {
lanes.template match<(bound | bindings<A>::mask)>(op.type.lanes(), state)) {
return true;
}
}
Expand All @@ -1899,7 +1898,7 @@ struct VectorReduceOp {
HALIDE_ALWAYS_INLINE bool match(const VectorReduceOp<A2, B2, reduce_op_2> &op, MatcherState &state) const noexcept {
return (reduce_op == reduce_op_2 &&
a.template match<bound>(unwrap(op.a), state) &&
lanes.template match < bound | bindings<A>::mask > (unwrap(op.lanes), state));
lanes.template match<(bound | bindings<A>::mask)>(unwrap(op.lanes), state));
}

HALIDE_ALWAYS_INLINE
Expand Down Expand Up @@ -2148,9 +2147,9 @@ struct SliceOp {
return v.vectors.size() == 1 &&
v.is_slice() &&
vec.template match<bound>(*v.vectors[0].get(), state) &&
base.template match < bound | bindings<Vec>::mask > (v.slice_begin(), state) &&
stride.template match < bound | bindings<Vec>::mask | bindings<Base>::mask > (v.slice_stride(), state) &&
lanes.template match < bound | bindings<Vec>::mask | bindings<Base>::mask | bindings<Stride>::mask > (v.type.lanes(), state);
base.template match<(bound | bindings<Vec>::mask)>(v.slice_begin(), state) &&
stride.template match<(bound | bindings<Vec>::mask | bindings<Base>::mask)>(v.slice_stride(), state) &&
lanes.template match<(bound | bindings<Vec>::mask | bindings<Base>::mask | bindings<Stride>::mask)>(v.type.lanes(), state);
}

HALIDE_ALWAYS_INLINE
Expand Down

0 comments on commit 69ecb43

Please sign in to comment.