-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[aarch64] Fix Arm64EC libcall lowering after recent refactoring. #143977
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
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
; RUN: llc -mtriple=arm64ec-pc-windows-msvc < %s | FileCheck %s | ||
|
||
define void @f1(ptr %p, i64 %n) { | ||
; CHECK-LABEL: "#f1": | ||
; CHECK: bl "#memset" | ||
call void @llvm.memset.p0.i64(ptr %p, i8 0, i64 %n, i1 false) | ||
ret void | ||
} | ||
|
||
define void @f2(ptr %p1, ptr %p2, i64 %n) { | ||
; CHECK-LABEL: "#f2": | ||
; CHECK: bl "#memcpy" | ||
call void @llvm.memcpy.p0.i64(ptr %p1, ptr %p2, i64 %n, i1 false) | ||
ret void | ||
} | ||
|
||
define double @f3(double %x, double %y) { | ||
; CHECK-LABEL: "#f3": | ||
; CHECK: b "#fmod" | ||
%r = frem double %x, %y | ||
ret double %r | ||
} | ||
|
||
define i128 @f4(i128 %x, i128 %y) { | ||
; CHECK-LABEL: "#f4": | ||
; CHECK: bl "#__divti3" | ||
%r = sdiv i128 %x, %y | ||
ret i128 %r | ||
} | ||
|
||
; FIXME: This is wrong; should be "#__aarch64_cas1_relax" | ||
define i8 @f5(i8 %expected, i8 %new, ptr %ptr) "target-features"="+outline-atomics" { | ||
; CHECK-LABEL: "#f5": | ||
; CHECK: bl __aarch64_cas1_relax | ||
%pair = cmpxchg ptr %ptr, i8 %expected, i8 %new monotonic monotonic, align 1 | ||
%r = extractvalue { i8, i1 } %pair, 0 | ||
ret i8 %r | ||
} | ||
|
||
define float @f6(float %val, i32 %a) { | ||
; CHECK-LABEL: "#f6": | ||
; CHECK: bl "#ldexp" | ||
%call = tail call fast float @llvm.ldexp.f32(float %val, i32 %a) | ||
ret float %call | ||
} |
Oops, something went wrong.
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.
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.
Can you also test some outline atomic cases set in https://github.com/llvm/llvm-project/blob/22f9b4aa1dad597d908be77be1e10ba4c77330ce/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp#L970
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.
And I assume this also hits these special cases:
llvm-project/llvm/lib/IR/RuntimeLibcalls.cpp
Line 465 in 22f9b4a
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.
And these maybe?
llvm-project/llvm/lib/IR/RuntimeLibcalls.cpp
Line 438 in 22f9b4a
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 looks like outlined atomics are broken; I'll add a testcase with the broken behavior. Not going to try to fix it right now (I'm not sure how to fix it given the way the code is currently structured, and it's not really a useful feature on Windows anyway.)
_alldiv etc. are, as far as I know, only a thing on 32-bit x86. 32-bit Arm has different libcalls, and 64-bit doesn't need libcalls for 64-bit operations. So I'm not sure sure there's anything to regression test. But I modified the code because it triggers the assertion otherwise.
llvm.ldexp.f32 correctly calls
#ldexp
(the 64-bit variant); I'll add a test. llvm.ldexp.f128 crashes for unrelated reasons (#144006).