-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[MIPS] Fix -msingle-float doesn't work with double on O32 #107543
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-llvm-selectiondag Author: None (yingopq) ChangesSkip the following function 'CustomLowerNode' when the operand had done Fix #93052 Full diff: https://github.com/llvm/llvm-project/pull/107543.diff 1 Files Affected:
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index fefb0844f1ab53..b879f40dfd85a9 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -2760,9 +2760,19 @@ void DAGTypeLegalizer::ExpandIntegerResult(SDNode *N, unsigned ResNo) {
LLVM_DEBUG(dbgs() << "Expand integer result: "; N->dump(&DAG));
SDValue Lo, Hi;
Lo = Hi = SDValue();
+ bool NeedCustomLower = true;
+
+ // Skip the following function 'CustomLowerNode' when the operand had done
+ // `SoftenFloatResult`.
+ if (N->getOpcode() == ISD::BITCAST &&
+ getTypeAction(N->getOperand(0).getValueType()) ==
+ TargetLowering::TypeSoftenFloat &&
+ N->getValueType(ResNo) ==
+ GetSoftenedFloat(N->getOperand(0)).getValueType())
+ NeedCustomLower = false;
// See if the target wants to custom expand this node.
- if (CustomLowerNode(N, N->getValueType(ResNo), true))
+ if (NeedCustomLower && CustomLowerNode(N, N->getValueType(ResNo), true))
return;
switch (N->getOpcode()) {
|
Needs tests |
e0bd6e8
to
a5fd28e
Compare
OK, added. |
No. This problem is about clang not llc. |
The This fix can resolve the bug reported, and when configured
|
|
||
// Skip the following function 'CustomLowerNode' when the operand had done | ||
// `SoftenFloatResult`. | ||
if (N->getOpcode() == ISD::BITCAST && |
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.
Shouldn't be special casing a specific opcode here, and shouldn't need to check the type of the actual softened result. It is also OK to request custom lowering on illegal types
Ohh. Thanks. Your patch fixes this problem. And I will approve this PR once you fix the problem Matt found. |
I mean the entire thing is suspect, you can request custom lowering on illegal types so CustomLowerNode should never be skipped |
OK, I would find another solution. |
a5fd28e
to
741a80d
Compare
@wzssyqa I updated the code, please help review. Thanks! |
741a80d
to
94ba52d
Compare
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.
LGTM - cheers
; RUN: llc -march=mips -mcpu=mips32 -mattr=single-float -O2 < %s | FileCheck %s | ||
; RUN: llc -march=mips -mcpu=mips32r2 -mattr=single-float -O2 < %s | FileCheck %s |
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.
Don't need -O2. The mattr is also missing +, and -march should be mtriple
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.
OK, applied, thanks!
Skip the following function 'CustomLowerNode' when the operand had done `SoftenFloatResult`. Fix llvm#93052
94ba52d
to
822625f
Compare
Skip the following function 'CustomLowerNode' when the operand had done
SoftenFloatResult
.Fix #93052