rust-lang / rust-lang/rustc_codegen_gcc
Support f16 on targets where GCC doesn't support it
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Rust
- Stars
- 1.2k
- Forks
- 105
- Avg merge
- 8h 20m
- Merged PRs (30d)
- 14
Description
@tgross35 mentioned we could support it the following way:
1. Treat it as a u16 in ABI (calling convention, alignment, etc)
2. To extend: call `__extendhfsf2` for f16->f32, `__extendhfdf2` for f16->f64
3. To trunc: call `__truncsfhf2` for f32->f16, `__truncdfhf2` for f64->f16
4. For arithmetic: extend to `f32`, perform the op, truncate back to `f16`
5. For casts to/from int: go via f32
6. For math ops: if I get https://github.com/rust-lang/rust/pull/150946 over the line then this won't be needed in most cases, but anything else can go via f32
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests; begin by locating existing f16 handling in the Rust GCC codegen backend and the ABI, conversion, arithmetic, cast, and math entry points. Use the listed helper symbols and rust-lang/rust pull request 150946 as context, and consider the work done when all six cases operate on targets where GCC lacks native f16 support.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100