[llvm] [X86] Fold XOR of two vgf2p8affineqb instructions with same input (PR #179900)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 5 06:26:26 PST 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- llvm/lib/Target/X86/X86ISelLowering.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 3c6a83c5c..bfd3b6ddc 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -56011,19 +56011,18 @@ static SDValue combineXorWithGF2P8AFFINEQB(SDNode *N, const SDLoc &DL,
// together. XORing two affine transformations of the same input can be folded
// by XORing both their matrices and immediates together.
static SDValue combineXorWithTwoGF2P8AFFINEQB(SDNode *N, const SDLoc &DL,
- SelectionDAG &DAG, EVT VT) {
+ SelectionDAG &DAG, EVT VT) {
using namespace SDPatternMatch;
SDValue X0, Y0, Y1;
APInt Imm0, Imm1;
// Use sd_match for structure matching - m_Xor handles commutation
// Match: GF2P8AFFINEQB(x, m1, i1) ^ GF2P8AFFINEQB(x, m2, i2)
- if (!sd_match(N, m_Xor(m_OneUse(m_TernaryOp(X86ISD::GF2P8AFFINEQB,
- m_Value(X0), m_Value(Y0),
- m_ConstInt(Imm0))),
- m_OneUse(m_TernaryOp(X86ISD::GF2P8AFFINEQB,
- m_Deferred(X0), m_Value(Y1),
- m_ConstInt(Imm1))))))
+ if (!sd_match(
+ N, m_Xor(m_OneUse(m_TernaryOp(X86ISD::GF2P8AFFINEQB, m_Value(X0),
+ m_Value(Y0), m_ConstInt(Imm0))),
+ m_OneUse(m_TernaryOp(X86ISD::GF2P8AFFINEQB, m_Deferred(X0),
+ m_Value(Y1), m_ConstInt(Imm1))))))
return SDValue();
assert((VT == MVT::v16i8 || VT == MVT::v32i8 || VT == MVT::v64i8) &&
@@ -56145,7 +56144,6 @@ static SDValue combineXor(SDNode *N, SelectionDAG &DAG,
if (SDValue R = combineXorWithTwoGF2P8AFFINEQB(N, DL, DAG, VT))
return R;
-
// Fold not(iX bitcast(vXi1)) -> (iX bitcast(not(vec))) for legal boolvecs.
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
if (llvm::isAllOnesConstant(N1) && N0.getOpcode() == ISD::BITCAST &&
``````````
</details>
https://github.com/llvm/llvm-project/pull/179900
More information about the llvm-commits
mailing list