Skip to content

Add supported asm types for LoongArch32 - #142248

Merged
bors merged 1 commit into
rust-lang:masterfrom
heiher:loong32-asm-types
Jun 13, 2025
Merged

Add supported asm types for LoongArch32#142248
bors merged 1 commit into
rust-lang:masterfrom
heiher:loong32-asm-types

Conversation

@heiher

Copy link
Copy Markdown
Contributor

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 9, 2025
match self {
Self::reg => types! { _: I8, I16, I32, I64, F32, F64; },
Self::reg => {
if arch == InlineAsmArch::LoongArch64 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make this an exhaustive match?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

| SPARC | `reg` | None | `i8`, `i16`, `i32`, `i64` (SPARC64 only) |
| SPARC | `yreg` | N/A | Only clobbers |
| LoongArch32 | `reg` | None | `i8`, `i16`, `i32`, `f32` |
| LoongArch32 | `freg` | None | `f32`, `f64` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code above reference LoongArch64 but this table doesn't. Is that a mistake?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add LoongArch32 to the table above?

The code above reference LoongArch64 but this table doesn't. Is that a mistake?

LoongArch64 assembly is already stable. This PR adds it for LoongArch32.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines +42 to +44
types! { _: I8, I16, I32, I64, F32, F64; }
} else {
types! { _: I8, I16, I32, F32; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not something to do here, but as a note f16 could probably get allowed in GPRs at some point (maybe also fregs? Not sure what the ABI status is), cc #125398.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll submit a separate PR to add support for types like f16 for both LoongArch32 and LoongArch64.

@heiher
heiherforce-pushed the loong32-asm-types branch from 55cfa4b to 28c06c4CompareJune 10, 2025 03:19
(Self::reg, InlineAsmArch::LoongArch64) => types! { _: I8, I16, I32, I64, F32, F64; },
(Self::reg, InlineAsmArch::LoongArch32) => types! { _: I8, I16, I32, F32; },
(Self::freg, _) => types! { f: F32; d: F64; },
_ => unimplemented!("unsupported register class"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be unreachable! instead of unimplemented!.

@heiher
heiherforce-pushed the loong32-asm-types branch from 28c06c4 to de8a91bCompareJune 10, 2025 10:49
@Amanieu

Copy link
Copy Markdown
Member

@bors r+ rollup

@bors

bors commented Jun 10, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit de8a91b has been approved by Amanieu

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 10, 2025
fmease added a commit to fmease/rust that referenced this pull request Jun 10, 2025
Add supported asm types for LoongArch32
r? `@Amanieu`
@fmeasefmease mentioned this pull request Jun 10, 2025
bors added a commit that referenced this pull request Jun 11, 2025
Rollup of 13 pull requests
Successful merges:
- #128425 (Make `missing_fragment_specifier` an unconditional error)
- #141639 (Expose discriminant values in stable_mir)
- #141967 (Configure bootstrap backport nominations through triagebot)
- #142042 (Make E0621 missing lifetime suggestion verbose)
- #142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches)
- #142235 (Build rustc with assertions in `dist-alt` jobs)
- #142248 (Add supported asm types for LoongArch32)
- #142272 (tests: Change ABIs in tests to more future-resilient ones)
- #142282 (Only run `citool` tests on the `auto` branch)
- #142285 (tests: Do not run afoul of asm.validity.non-exhaustive in input-stats)
- #142297 (Implement `//@ needs-target-std` compiletest directive)
- #142298 (Make loongarch-none target maintainers more easily pingable)
- #142306 (Dont unwrap and re-wrap typing envs)
Failed merges:
- #141942 (Implement representation options to smir)
r? `@ghost`
`@rustbot` modify labels: rollup
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 11, 2025
Add supported asm types for LoongArch32
r? ``@Amanieu``
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 11, 2025
Add supported asm types for LoongArch32
r? ```@Amanieu```
bors added a commit that referenced this pull request Jun 11, 2025
Rollup of 13 pull requests
Successful merges:
- #134841 (Look at proc-macro attributes when encountering unknown attribute)
- #141639 (Expose discriminant values in stable_mir)
- #141967 (Configure bootstrap backport nominations through triagebot)
- #142042 (Make E0621 missing lifetime suggestion verbose)
- #142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches)
- #142248 (Add supported asm types for LoongArch32)
- #142272 (tests: Change ABIs in tests to more future-resilient ones)
- #142282 (Only run `citool` tests on the `auto` branch)
- #142297 (Implement `//@ needs-target-std` compiletest directive)
- #142298 (Make loongarch-none target maintainers more easily pingable)
- #142306 (Dont unwrap and re-wrap typing envs)
- #142324 (Remove unneeded `FunctionCx` from some codegen methods)
- #142328 (feat: Add `bit_width` for unsigned integer types)
r? `@ghost`
`@rustbot` modify labels: rollup
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 12, 2025
Add supported asm types for LoongArch32
r? ````@Amanieu````
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 12, 2025
Add supported asm types for LoongArch32
r? `````@Amanieu`````
bors added a commit that referenced this pull request Jun 13, 2025
Rollup of 9 pull requests
Successful merges:
- #128425 (Make `missing_fragment_specifier` an unconditional error)
- #135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features)
- #140770 (add `extern "custom"` functions)
- #142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches)
- #142248 (Add supported asm types for LoongArch32)
- #142267 (assert more in release in `rustc_ast_lowering`)
- #142274 (Update the stdarch submodule)
- #142276 (Update dependencies in `library/Cargo.lock`)
- #142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library)
Failed merges:
- #140920 (Extract some shared code from codegen backend target feature handling)
r? `@ghost`
`@rustbot` modify labels: rollup
try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various
bors added a commit that referenced this pull request Jun 13, 2025
Rollup of 9 pull requests
Successful merges:
- #128425 (Make `missing_fragment_specifier` an unconditional error)
- #135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features)
- #140770 (add `extern "custom"` functions)
- #142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches)
- #142248 (Add supported asm types for LoongArch32)
- #142267 (assert more in release in `rustc_ast_lowering`)
- #142274 (Update the stdarch submodule)
- #142276 (Update dependencies in `library/Cargo.lock`)
- #142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library)
Failed merges:
- #140920 (Extract some shared code from codegen backend target feature handling)
r? `@ghost`
`@rustbot` modify labels: rollup
try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various
@bors
bors merged commit f6b02bb into rust-lang:masterJun 13, 2025
@rustbotrustbot added this to the 1.89.0 milestone Jun 13, 2025
rust-timer added a commit that referenced this pull request Jun 13, 2025
Rollup merge of #142248 - heiher:loong32-asm-types, r=Amanieu
Add supported asm types for LoongArch32
r? ``````@Amanieu``````
@heiher
heiher deleted the loong32-asm-types branch June 13, 2025 21:29
github-actionsBot pushed a commit to rust-lang/miri that referenced this pull request Jun 14, 2025
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#128425 (Make `missing_fragment_specifier` an unconditional error)
- rust-lang/rust#135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features)
- rust-lang/rust#140770 (add `extern "custom"` functions)
- rust-lang/rust#142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches)
- rust-lang/rust#142248 (Add supported asm types for LoongArch32)
- rust-lang/rust#142267 (assert more in release in `rustc_ast_lowering`)
- rust-lang/rust#142274 (Update the stdarch submodule)
- rust-lang/rust#142276 (Update dependencies in `library/Cargo.lock`)
- rust-lang/rust#142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library)
Failed merges:
- rust-lang/rust#140920 (Extract some shared code from codegen backend target feature handling)
r? `@ghost`
`@rustbot` modify labels: rollup
try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various
bjorn3 pushed a commit to rust-lang/rustc_codegen_cranelift that referenced this pull request Jun 14, 2025
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#128425 (Make `missing_fragment_specifier` an unconditional error)
- rust-lang/rust#135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features)
- rust-lang/rust#140770 (add `extern "custom"` functions)
- rust-lang/rust#142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches)
- rust-lang/rust#142248 (Add supported asm types for LoongArch32)
- rust-lang/rust#142267 (assert more in release in `rustc_ast_lowering`)
- rust-lang/rust#142274 (Update the stdarch submodule)
- rust-lang/rust#142276 (Update dependencies in `library/Cargo.lock`)
- rust-lang/rust#142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library)
Failed merges:
- rust-lang/rust#140920 (Extract some shared code from codegen backend target feature handling)
r? `@ghost`
`@rustbot` modify labels: rollup
try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various
github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jun 16, 2025
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#128425 (Make `missing_fragment_specifier` an unconditional error)
- rust-lang/rust#135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features)
- rust-lang/rust#140770 (add `extern "custom"` functions)
- rust-lang/rust#142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches)
- rust-lang/rust#142248 (Add supported asm types for LoongArch32)
- rust-lang/rust#142267 (assert more in release in `rustc_ast_lowering`)
- rust-lang/rust#142274 (Update the stdarch submodule)
- rust-lang/rust#142276 (Update dependencies in `library/Cargo.lock`)
- rust-lang/rust#142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library)
Failed merges:
- rust-lang/rust#140920 (Extract some shared code from codegen backend target feature handling)
r? `@ghost`
`@rustbot` modify labels: rollup
try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various
github-actionsBot pushed a commit to model-checking/verify-rust-std that referenced this pull request Jun 18, 2025
…iaskrgr
Rollup of 9 pull requests
Successful merges:
- rust-lang#128425 (Make `missing_fragment_specifier` an unconditional error)
- rust-lang#135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features)
- rust-lang#140770 (add `extern "custom"` functions)
- rust-lang#142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches)
- rust-lang#142248 (Add supported asm types for LoongArch32)
- rust-lang#142267 (assert more in release in `rustc_ast_lowering`)
- rust-lang#142274 (Update the stdarch submodule)
- rust-lang#142276 (Update dependencies in `library/Cargo.lock`)
- rust-lang#142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library)
Failed merges:
- rust-lang#140920 (Extract some shared code from codegen backend target feature handling)
r? `@ghost`
`@rustbot` modify labels: rollup
try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various
antoyo pushed a commit to rust-lang/rustc_codegen_gcc that referenced this pull request Jun 28, 2025
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#128425 (Make `missing_fragment_specifier` an unconditional error)
- rust-lang/rust#135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features)
- rust-lang/rust#140770 (add `extern "custom"` functions)
- rust-lang/rust#142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches)
- rust-lang/rust#142248 (Add supported asm types for LoongArch32)
- rust-lang/rust#142267 (assert more in release in `rustc_ast_lowering`)
- rust-lang/rust#142274 (Update the stdarch submodule)
- rust-lang/rust#142276 (Update dependencies in `library/Cargo.lock`)
- rust-lang/rust#142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library)
Failed merges:
- rust-lang/rust#140920 (Extract some shared code from codegen backend target feature handling)
r? `@ghost`
`@rustbot` modify labels: rollup
try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various
christian-schilling pushed a commit to christian-schilling/rustc_codegen_cranelift that referenced this pull request Jan 27, 2026
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#128425 (Make `missing_fragment_specifier` an unconditional error)
- rust-lang/rust#135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features)
- rust-lang/rust#140770 (add `extern "custom"` functions)
- rust-lang/rust#142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches)
- rust-lang/rust#142248 (Add supported asm types for LoongArch32)
- rust-lang/rust#142267 (assert more in release in `rustc_ast_lowering`)
- rust-lang/rust#142274 (Update the stdarch submodule)
- rust-lang/rust#142276 (Update dependencies in `library/Cargo.lock`)
- rust-lang/rust#142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library)
Failed merges:
- rust-lang/rust#140920 (Extract some shared code from codegen backend target feature handling)
r? `@ghost`
`@rustbot` modify labels: rollup
try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various
christian-schilling pushed a commit to christian-schilling/rustc_codegen_cranelift that referenced this pull request Jan 27, 2026
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#128425 (Make `missing_fragment_specifier` an unconditional error)
- rust-lang/rust#135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features)
- rust-lang/rust#140770 (add `extern "custom"` functions)
- rust-lang/rust#142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches)
- rust-lang/rust#142248 (Add supported asm types for LoongArch32)
- rust-lang/rust#142267 (assert more in release in `rustc_ast_lowering`)
- rust-lang/rust#142274 (Update the stdarch submodule)
- rust-lang/rust#142276 (Update dependencies in `library/Cargo.lock`)
- rust-lang/rust#142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library)
Failed merges:
- rust-lang/rust#140920 (Extract some shared code from codegen backend target feature handling)
r? `@ghost`
`@rustbot` modify labels: rollup
try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@heiher@Amanieu@bors@compiler-errors@tgross35@rustbot