-
Notifications
You must be signed in to change notification settings - Fork 15.2k
DAG: exp opcodes cannotBeOrderedNegativeFP #167604
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
Merged
arsenm
merged 1 commit into
main
from
users/arsenm/dag-cannot-be-ordered-negative-fp-exp
Nov 12, 2025
Merged
DAG: exp opcodes cannotBeOrderedNegativeFP #167604
arsenm
merged 1 commit into
main
from
users/arsenm/dag-cannot-be-ordered-negative-fp-exp
Nov 12, 2025
+14
−16
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Member
|
@llvm/pr-subscribers-backend-aarch64 @llvm/pr-subscribers-llvm-selectiondag Author: Matt Arsenault (arsenm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/167604.diff 2 Files Affected:
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index b5d502b90c90c..efa557c4b9128 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -6306,7 +6306,17 @@ bool SelectionDAG::cannotBeOrderedNegativeFP(SDValue Op) const {
if (ConstantFPSDNode *C1 = isConstOrConstSplatFP(Op, true))
return !C1->isNegative();
- return Op.getOpcode() == ISD::FABS;
+ switch (Op.getOpcode()) {
+ case ISD::FABS:
+ case ISD::FEXP:
+ case ISD::FEXP2:
+ case ISD::FEXP10:
+ return true;
+ default:
+ return false;
+ }
+
+ llvm_unreachable("covered opcode switch");
}
bool SelectionDAG::isEqualTo(SDValue A, SDValue B) const {
diff --git a/llvm/test/CodeGen/AArch64/frem-power2.ll b/llvm/test/CodeGen/AArch64/frem-power2.ll
index 52bc704eadc89..179df026e25d6 100644
--- a/llvm/test/CodeGen/AArch64/frem-power2.ll
+++ b/llvm/test/CodeGen/AArch64/frem-power2.ll
@@ -91,14 +91,10 @@ define float @frem2_exp(float %x) #0 {
; CHECK-SD-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-SD-NEXT: bl expf
; CHECK-SD-NEXT: fmov s1, #0.50000000
-; CHECK-SD-NEXT: // kill: def $s0 killed $s0 def $q0
; CHECK-SD-NEXT: fmov s2, #-2.00000000
; CHECK-SD-NEXT: fmul s1, s0, s1
; CHECK-SD-NEXT: frintz s1, s1
-; CHECK-SD-NEXT: fmadd s1, s1, s2, s0
-; CHECK-SD-NEXT: mvni v2.4s, #128, lsl #24
-; CHECK-SD-NEXT: bit v0.16b, v1.16b, v2.16b
-; CHECK-SD-NEXT: // kill: def $s0 killed $s0 killed $q0
+; CHECK-SD-NEXT: fmadd s0, s1, s2, s0
; CHECK-SD-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-SD-NEXT: ret
;
@@ -121,14 +117,10 @@ define float @frem2_exp2(float %x) #0 {
; CHECK-SD-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-SD-NEXT: bl exp2f
; CHECK-SD-NEXT: fmov s1, #0.50000000
-; CHECK-SD-NEXT: // kill: def $s0 killed $s0 def $q0
; CHECK-SD-NEXT: fmov s2, #-2.00000000
; CHECK-SD-NEXT: fmul s1, s0, s1
; CHECK-SD-NEXT: frintz s1, s1
-; CHECK-SD-NEXT: fmadd s1, s1, s2, s0
-; CHECK-SD-NEXT: mvni v2.4s, #128, lsl #24
-; CHECK-SD-NEXT: bit v0.16b, v1.16b, v2.16b
-; CHECK-SD-NEXT: // kill: def $s0 killed $s0 killed $q0
+; CHECK-SD-NEXT: fmadd s0, s1, s2, s0
; CHECK-SD-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-SD-NEXT: ret
;
@@ -151,14 +143,10 @@ define float @frem2_exp10(float %x) #0 {
; CHECK-SD-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
; CHECK-SD-NEXT: bl exp10f
; CHECK-SD-NEXT: fmov s1, #0.50000000
-; CHECK-SD-NEXT: // kill: def $s0 killed $s0 def $q0
; CHECK-SD-NEXT: fmov s2, #-2.00000000
; CHECK-SD-NEXT: fmul s1, s0, s1
; CHECK-SD-NEXT: frintz s1, s1
-; CHECK-SD-NEXT: fmadd s1, s1, s2, s0
-; CHECK-SD-NEXT: mvni v2.4s, #128, lsl #24
-; CHECK-SD-NEXT: bit v0.16b, v1.16b, v2.16b
-; CHECK-SD-NEXT: // kill: def $s0 killed $s0 killed $q0
+; CHECK-SD-NEXT: fmadd s0, s1, s2, s0
; CHECK-SD-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
; CHECK-SD-NEXT: ret
;
|
RKSimon
approved these changes
Nov 12, 2025
Base automatically changed from
users/arsenm/aarch64/add-baseline-exp-opcodes-known-positive
to
main
November 12, 2025 18:46
730fc7e to
d7532c2
Compare
git-crd
pushed a commit
to git-crd/crd-llvm-project
that referenced
this pull request
Nov 13, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

No description provided.