-
Notifications
You must be signed in to change notification settings - Fork 13.5k
PPC: Custom lower ppcf128 is_fpclass if is_fpclass is custom #105540
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
Conversation
@llvm/pr-subscribers-backend-powerpc Author: Matt Arsenault (arsenm) ChangesUnfortunately expandIS_FPCLASS is called directly in SelectionDAGBuilder Full diff: https://github.com/llvm/llvm-project/pull/105540.diff 1 Files Affected:
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index 459a96eca1ff20..a5bc24b55660a5 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -1221,6 +1221,7 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM,
setOperationAction(ISD::IS_FPCLASS, MVT::f32, Custom);
setOperationAction(ISD::IS_FPCLASS, MVT::f64, Custom);
setOperationAction(ISD::IS_FPCLASS, MVT::f128, Custom);
+ setOperationAction(ISD::IS_FPCLASS, MVT::ppcf128, Custom);
}
// 128 bit shifts can be accomplished via 3 instructions for SHL and
@@ -11479,6 +11480,12 @@ SDValue PPCTargetLowering::LowerIS_FPCLASS(SDValue Op,
uint64_t RHSC = Op.getConstantOperandVal(1);
SDLoc Dl(Op);
FPClassTest Category = static_cast<FPClassTest>(RHSC);
+ if (LHS.getValueType() == MVT::ppcf128) {
+ // The higher part determines the value class.
+ LHS = DAG.getNode(ISD::EXTRACT_ELEMENT, Dl, MVT::f64, LHS,
+ DAG.getConstant(1, Dl, MVT::i32));
+ }
+
return getDataClassTest(LHS, Category, Dl, DAG, Subtarget);
}
|
@@ -11479,6 +11480,12 @@ SDValue PPCTargetLowering::LowerIS_FPCLASS(SDValue Op, | |||
uint64_t RHSC = Op.getConstantOperandVal(1); | |||
SDLoc Dl(Op); | |||
FPClassTest Category = static_cast<FPClassTest>(RHSC); | |||
if (LHS.getValueType() == MVT::ppcf128) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this code:
llvm-project/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Lines 8678 to 8684 in 902b2a2
// PPC double double is a pair of doubles, of which the higher part determines | |
// the value class. | |
if (OperandVT == MVT::ppcf128) { | |
Op = DAG.getNode(ISD::EXTRACT_ELEMENT, DL, MVT::f64, Op, | |
DAG.getConstant(1, DL, MVT::i32)); | |
OperandVT = MVT::f64; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is still needed. PPC only custom lowers this for Subtarget.useCRBits, otherwise it still hits the default expansion
99b4eb6
to
5c5122c
Compare
LGTM. |
Merge activity
|
5c5122c
to
151d8a4
Compare
Unfortunately expandIS_FPCLASS is called directly in SelectionDAGBuilder depending on whether IS_FPCLASS is custom or not. This helps avoid ppc test regressions in a future patch where the custom lowering would be bypassed.
151d8a4
to
4db76dc
Compare
Unfortunately expandIS_FPCLASS is called directly in SelectionDAGBuilder
depending on whether IS_FPCLASS is custom or not. This helps avoid ppc test
regressions in a future patch where the custom lowering would be bypassed.