-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Enable f16 in assembly on aarch64 platforms that support it #126070
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @oli-obk (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
r? @tgross35 |
Failed to set assignee to
|
That was fast :) Can you change the “fixes” tag so it doesn’t close that issue? We’ll still have to add the other platforms, but those can come separately @rustbot label +F-f16_and_f128 |
a1d89bd
to
488fac9
Compare
@@ -62,6 +62,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { | |||
ty::Int(IntTy::I64) | ty::Uint(UintTy::U64) => Some(InlineAsmType::I64), | |||
ty::Int(IntTy::I128) | ty::Uint(UintTy::U128) => Some(InlineAsmType::I128), | |||
ty::Int(IntTy::Isize) | ty::Uint(UintTy::Usize) => Some(asm_ty_isize), | |||
ty::Float(FloatTy::F16) => Some(InlineAsmType::F16), |
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 we have the same issues for f128
?
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's probably okay to handle f128 in a separate PR, since we might want a special test that it actually works right on s390x (it has f128 arithmetic operations but it looks like the float ABI might not use vector registers?). Still no harm in having it here without enabling it on a target of course
@bors r+ rollup |
Enable f16 in assembly on aarch64 platforms that support it Issue: rust-lang#125398
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#116088 (Stabilise `c_unwind`) - rust-lang#124012 (Stabilize `binary_heap_as_slice`) - rust-lang#124214 (Parse unsafe attributes) - rust-lang#125572 (Detect pub structs never constructed and unused associated constants) - rust-lang#125781 (prefer `compile::stream_cargo` for building tools) - rust-lang#126030 (Update `./x fmt` command in library/std/src/sys/pal/windows/c/README.md) - rust-lang#126047 (Simplify the rayon calls in the installer) - rust-lang#126070 (Enable f16 in assembly on aarch64 platforms that support it) - rust-lang#126089 (Stabilize Option::take_if) - rust-lang#126112 (Clean up source root in run-make tests) - rust-lang#126119 (Improve docs for using custom paths with `--emit`) r? `@ghost` `@rustbot` modify labels: rollup
@lengrongfu for reference if you are on an x86 host, you are supposed to be able to replicate the CI tests by running So if that doesn't work and you don't have an aarch host, you can just temporarily enable the aarch64 CI test to verify this PR (without reapproval and bors running the full suite). https://rustc-dev-guide.rust-lang.org/tests/ci.html#using-ci-to-test |
@tgross35 I use macOS m3, which is aarch64 arch. I use file //@ only-aarch64
#![feature(f16, f128)]
use std::arch::asm;
#[inline(never)]
pub fn f32_to_f16_asm(a: f32) -> f16 {
let ret: f16;
unsafe {
asm!(
"fcvt {ret:h}, {a:s}",
a = in(vreg) a,
ret = lateout(vreg) ret,
options(nomem, nostack),
);
}
ret
}
fn main() {
} |
UI tests are expected to produce errors by default, meaning you need a .stderr file and ERROR directives. You need to add either You probably want either build-pass or assertions + run-pass here to make sure LLVM actually sees the assembly, I don’t think check-pass does that. There is some more info here: https://rustc-dev-guide.rust-lang.org/tests/ui.html |
488fac9
to
474fbca
Compare
@lengrongfu comment |
474fbca
to
806dc5d
Compare
@rustbot ready |
This needs tests in tests/assembly/asm. See #126417 for an example. |
@rustbot author |
@lengrongfu are you able to rebase this and add a test? You can drop the changes to hir_analysis and target/src/asm/mod.rs since they were added in #126417, meaning this PR will look more like #126555. |
Signed-off-by: rongfu.leng <[email protected]>
806dc5d
to
dd8dc65
Compare
Some changes occurred in src/tools/cargo cc @ehuss |
This comment has been minimized.
This comment has been minimized.
Looks like you accidentally grabbed submodules while rebasing. You can do |
There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged. You can start a rebase with the following commands:
The following commits are merge commits: |
The job Click to see the possible cause of the failure (guessed by this bot)
|
Issue: #125398