[llvm] [AMDGPU] Implement hasAndNot for scalar bitwise AND-NOT operations. (PR #112647)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 22:31:52 PDT 2024
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 5e9166e02ab65d42efba014f2adc59c42b097ddc 2c9aa28f7548634817ba18871bbcf42d6885c4b3 --extensions h,cpp -- llvm/lib/Target/AMDGPU/SIISelLowering.cpp llvm/lib/Target/AMDGPU/SIISelLowering.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index b78168131e..4f6e4ca82e 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -6822,15 +6822,14 @@ static unsigned getExtOpcodeForPromotedOp(SDValue Op) {
}
}
-SDValue SITargetLowering::combineAnd(SDValue Op,
- DAGCombinerInfo &DCI) const {
+SDValue SITargetLowering::combineAnd(SDValue Op, DAGCombinerInfo &DCI) const {
const unsigned Opc = Op.getOpcode();
assert(Opc == ISD::AND);
auto &DAG = DCI.DAG;
SDLoc DL(Op);
- if(hasAndNot(Op)) {
+ if (hasAndNot(Op)) {
SDValue LHS = Op->getOperand(0);
SDValue RHS = Op->getOperand(1);
@@ -6839,20 +6838,24 @@ SDValue SITargetLowering::combineAnd(SDValue Op,
SDValue Y = RHS->getOperand(0);
SDValue NotZ = RHS->getOperand(1);
- if (NotZ.getOpcode() == ISD::XOR && isAllOnesConstant(NotZ->getOperand(1))) {
+ if (NotZ.getOpcode() == ISD::XOR &&
+ isAllOnesConstant(NotZ->getOperand(1))) {
SDValue Z = NotZ->getOperand(0);
if (!isa<ConstantSDNode>(Y)) {
SDValue NotY = DAG.getNOT(DL, Y, Y.getValueType());
- SDValue AndNotYZ = DAG.getNode(ISD::AND, DL, Y.getValueType(), NotY, Z);
- SDValue NotAndNotYZ = DAG.getNOT(DL, AndNotYZ, AndNotYZ.getValueType());
- SDValue NewAnd = DAG.getNode(ISD::AND, DL, Op.getValueType(), LHS, NotAndNotYZ);
+ SDValue AndNotYZ =
+ DAG.getNode(ISD::AND, DL, Y.getValueType(), NotY, Z);
+ SDValue NotAndNotYZ =
+ DAG.getNOT(DL, AndNotYZ, AndNotYZ.getValueType());
+ SDValue NewAnd =
+ DAG.getNode(ISD::AND, DL, Op.getValueType(), LHS, NotAndNotYZ);
return NewAnd;
}
}
}
}
-
+
EVT OpTy = (Opc != ISD::SETCC) ? Op.getValueType()
: Op->getOperand(0).getValueType();
auto ExtTy = OpTy.changeElementType(MVT::i32);
``````````
</details>
https://github.com/llvm/llvm-project/pull/112647
More information about the llvm-commits
mailing list