[llvm] [AArch64][InstCombine] xor(cmpne) -> cmpeq (PR #207007)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 05:32:09 PDT 2026
================
@@ -2142,10 +2142,43 @@ static std::optional<Instruction *> instCombineSVEDupX(InstCombiner &IC,
return IC.replaceInstUsesWith(II, Splat);
}
+static std::optional<Instruction *> instCombineXorSVECmpNE(InstCombiner &IC,
+ IntrinsicInst &II) {
+ if (!match(II.getOperand(2), m_Zero()) || !II.hasOneUse())
+ return std::nullopt;
+
+ auto *User = cast<Instruction>(*II.user_begin());
+ if (!match(User, m_c_Xor(m_Specific(&II), m_Specific(II.getOperand(0)))))
+ return std::nullopt;
+
+ Intrinsic::ID IID;
+ switch ((II.getIntrinsicID())) {
+ case Intrinsic::aarch64_sve_cmpne:
+ IID = Intrinsic::aarch64_sve_cmpeq;
+ break;
+ case Intrinsic::aarch64_sve_cmpne_wide:
+ IID = Intrinsic::aarch64_sve_cmpeq_wide;
----------------
paulwalker-arm wrote:
I'm happy to defer the work, but presumably this transformation is applicable across all integer comparisons?
https://github.com/llvm/llvm-project/pull/207007
More information about the llvm-commits
mailing list