-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Allow clobbering unsupported registers in asm! #83841
Conversation
cc @rust-lang/wg-inline-asm |
This comment has been minimized.
This comment has been minimized.
fd8b37e
to
4d5f999
Compare
Previously registers could only be marked as clobbered if the target feature for that register was enabled. This restriction is now removed.
4d5f999
to
ddc53f8
Compare
let mut layout = None; | ||
let ty = if let Some(ref place) = place { | ||
layout = Some(&place.layout); | ||
llvm_fixup_output_type(self.cx, reg.reg_class(), &place.layout) | ||
} else if !is_target_supported(reg.reg_class()) { |
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.
Why does this need to happen conditionally? Can't we always "just" clobber the clobber-like constraints, regardless of the target features?
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.
Just clobbering loses the distinction between out
and lateout
: LLVM clobbers act like an out
, which prevents the registers from being used as an input. However in the case of lateout
we want to allow the register allocator to use the register being clobbered as an input.
For register classes that are unavailable due to disabled target features this is not a problem: the register can't be used as an input anyways.
LGTM r=me, your call what to do with the comments I left inline. EDIT: could you also add a test case for this comment if there isn't already one while at it? (AFAIU it would end up as a |
We have an x86 equivalent of this test in |
@bors r+ |
📌 Commit 31d0459 has been approved by |
Allow clobbering unsupported registers in asm! Previously registers could only be marked as clobbered if the target feature for that register was enabled. This restriction is now removed. cc rust-lang#81092 r? `@nagisa`
Rollup of 7 pull requests Successful merges: - rust-lang#80525 (wasm64 support) - rust-lang#83019 (core: disable `ptr::swap_nonoverlapping_one`'s block optimization on SPIR-V.) - rust-lang#83717 (rustdoc: Separate filter-empty-string out into its own function) - rust-lang#83807 (Tests: Remove redundant `ignore-tidy-linelength` annotations) - rust-lang#83815 (ptr::addr_of documentation improvements) - rust-lang#83820 (Remove attribute `#[link_args]`) - rust-lang#83841 (Allow clobbering unsupported registers in asm!) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Previously registers could only be marked as clobbered if the target feature for that register was enabled. This restriction is now removed.
cc #81092
r? @nagisa