Skip to content

X86: Remove LowerToHorizontalOp and modified test case #148477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions llvm/include/llvm/CodeGen/SDPatternMatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ struct Value_match {

explicit Value_match(SDValue Match) : MatchVal(Match) {}

template <typename MatchContext> bool match(const MatchContext &, SDValue N) {
template <typename MatchContext>
bool match(const MatchContext &, SDValue N) const {
if (MatchVal)
return MatchVal == N;
return N.getNode();
Expand Down Expand Up @@ -130,7 +131,8 @@ struct DeferredValue_match {

explicit DeferredValue_match(SDValue &Match) : MatchVal(Match) {}

template <typename MatchContext> bool match(const MatchContext &, SDValue N) {
template <typename MatchContext>
bool match(const MatchContext &, SDValue N) const {
return N == MatchVal;
}
};
Expand Down Expand Up @@ -196,7 +198,8 @@ struct Value_bind {

explicit Value_bind(SDValue &N) : BindVal(N) {}

template <typename MatchContext> bool match(const MatchContext &, SDValue N) {
template <typename MatchContext>
bool match(const MatchContext &, SDValue N) const {
BindVal = N;
return true;
}
Expand Down Expand Up @@ -975,8 +978,7 @@ template <typename Opnd> inline UnaryOpc_match<Opnd> m_BitCast(const Opnd &Op) {
return UnaryOpc_match<Opnd>(ISD::BITCAST, Op);
}

template <typename Opnd>
inline UnaryOpc_match<Opnd> m_BSwap(const Opnd &Op) {
template <typename Opnd> inline UnaryOpc_match<Opnd> m_BSwap(const Opnd &Op) {
return UnaryOpc_match<Opnd>(ISD::BSWAP, Op);
}

Expand Down Expand Up @@ -1203,7 +1205,8 @@ struct CondCode_match {

explicit CondCode_match(ISD::CondCode *CC) : BindCC(CC) {}

template <typename MatchContext> bool match(const MatchContext &, SDValue N) {
template <typename MatchContext>
bool match(const MatchContext &, SDValue N) const {
if (auto *CC = dyn_cast<CondCodeSDNode>(N.getNode())) {
if (CCToMatch && *CCToMatch != CC->get())
return false;
Expand Down
53 changes: 53 additions & 0 deletions llvm/include/llvm/CodeGen/SelectionDAGISelMatchers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
namespace llvm {
namespace SDPatternMatch {

// 1. 定義 SelectCC_match
template <typename LTy, typename RTy, typename TTy, typename FTy, typename CCTy>
struct SelectCC_match {
const LTy &L;
const RTy &R;
const TTy &T;
const FTy &F;
const CCTy &CC;

SelectCC_match(const LTy &l, const RTy &r,
const TTy &t, const FTy &f,
const CCTy &cc)
: L(l), R(r), T(t), F(f), CC(cc) {}

template <typename OpTy>
bool match(OpTy V) const {
if (V.getOpcode() != ISD::SELECT_CC)
return false;

return L.match(V.getOperand(0)) &&
R.match(V.getOperand(1)) &&
T.match(V.getOperand(2)) &&
F.match(V.getOperand(3)) &&
CC.match(cast<CondCodeSDNode>(V.getOperand(4))->get());
}
};

// 2. 定義 m_SelectCC
template <typename LTy, typename RTy, typename TTy, typename FTy, typename CCTy>
inline SelectCC_match<LTy, RTy, TTy, FTy, CCTy>
m_SelectCC(const LTy &L, const RTy &R,
const TTy &T, const FTy &F,
const CCTy &CC) {
return SelectCC_match<LTy, RTy, TTy, FTy, CCTy>(L, R, T, F, CC);
}

// 3. 定義 m_SelectCCLike
template <typename LTy, typename RTy, typename TTy, typename FTy, typename CCTy>
inline auto m_SelectCCLike(const LTy &L, const RTy &R,
const TTy &T, const FTy &F,
const CCTy &CC) {
return m_AnyOf(
m_Select(m_SetCC(L, R, CC), T, F),
m_SelectCC(L, R, T, F, CC)
);
}

} // namespace SDPatternMatch
} // namespace llvm

Loading
Loading