forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#126070 - lengrongfu:feat/enable-f16, r=oli-obk
Enable f16 in assembly on aarch64 platforms that support it Issue: rust-lang#125398
- Loading branch information
Showing
4 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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 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,17 @@ | ||
//@ 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 | ||
} |