Skip to content
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

Remove the reg_thumb register class for asm! on ARM #90796

Merged
merged 1 commit into from
Dec 9, 2021

Conversation

Amanieu
Copy link
Member

@Amanieu Amanieu commented Nov 11, 2021

Also restricts r8-r14 from being used on Thumb1 targets as per #90736.

cc @Lokathor

r? @joshtriplett

@rust-highfive
Copy link
Collaborator

Some changes occured to rustc_codegen_gcc

cc @antoyo

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 11, 2021
@rust-log-analyzer

This comment has been minimized.

@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 11, 2021
@Lokathor
Copy link
Contributor

I'm not totally familiar with thumb2, but i believe that you explained that when a low register is used in thumb2 code it's less total bytes to encode the code than when a high register is selected. If so, that seems a perfectly fine reason for a user to want to use the reg_thumb class, and we should keep it.

@Amanieu
Copy link
Member Author

Amanieu commented Nov 11, 2021

It seems like something that could be added later if there is demand for it. At the moment I'm not too happy about the confusion between reg and reg_thumb and wanted to simplify things.

@Lokathor
Copy link
Contributor

well, since reg_thumb maps to llvm l, then maybe just a rename to reg_low and some docs could solve the situation.

But since you're the one who will have to put it back in later, I won't get too worked up about you taking it out temporarily until someone specifically needs it.

Copy link
Contributor

@antoyo antoyo left a comment

Choose a reason for hiding this comment

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

The gcc part looks good to me.

@Amanieu
Copy link
Member Author

Amanieu commented Dec 2, 2021

ping @joshtriplett

@joshtriplett
Copy link
Member

Taking this out temporarily for stabilization seems reasonable, and we can consider adding a feature-gated version of this back in later.

@bors r+

@bors
Copy link
Contributor

bors commented Dec 7, 2021

📌 Commit 85480793a42084a6e45681ba305330c4fe20dd54 has been approved by joshtriplett

@bors bors 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 Dec 7, 2021
@bors
Copy link
Contributor

bors commented Dec 7, 2021

☔ The latest upstream changes (presumably #91224) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 7, 2021
Also restricts r8-r14 from being used on Thumb1 targets as per rust-lang#90736.
@Amanieu
Copy link
Member Author

Amanieu commented Dec 7, 2021

@bors r=joshtriplett

@bors
Copy link
Contributor

bors commented Dec 7, 2021

📌 Commit 908f300 has been approved by joshtriplett

@bors bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 7, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 8, 2021
…plett

Remove the reg_thumb register class for asm! on ARM

Also restricts r8-r14 from being used on Thumb1 targets as per rust-lang#90736.

cc `@Lokathor`

r? `@joshtriplett`
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 9, 2021
…askrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#87599 (Implement concat_bytes!)
 - rust-lang#89999 (Update std::env::temp_dir to use GetTempPath2 on Windows when available.)
 - rust-lang#90796 (Remove the reg_thumb register class for asm! on ARM)
 - rust-lang#91042 (Use Vec extend instead of repeated pushes on several places)
 - rust-lang#91634 (Do not attempt to suggest help for overly malformed struct/function call)
 - rust-lang#91685 (Install llvm tools to sysroot when assembling local toolchain)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 22a1331 into rust-lang:master Dec 9, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 9, 2021
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Dec 31, 2021
…plett

Remove the reg_thumb register class for asm! on ARM

Also restricts r8-r14 from being used on Thumb1 targets as per rust-lang#90736.

cc ``@Lokathor``

r? ``@joshtriplett``
r5: reg = ["r5", "v2"],
r7: reg = ["r7", "v4"] % frame_pointer_r7,
r8: reg = ["r8", "v5"] % not_thumb1,
r10: reg = ["r10", "sl"] % not_thumb1,
r11: reg = ["r11", "fp"] % frame_pointer_r11,
Copy link
Contributor

Choose a reason for hiding this comment

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

because this line does not add not_thumb1, thumb1 inline asm can still specify r11 as a clobber, which seems at odds with the documentation

@hudson-ayers
Copy link
Contributor

Cortex-m0 uses the thumbv6-m instruction set, which contains some thumb2 instructions but not the full set of 32 bit instructions that are part of thumb2.

Thumbv6-m does not pass the has_feature("thumb2") test, presumably because it does not implement the full thumb2 set of instructions. However, that means that this PR prevents clobbering r8 + on cortex-m0, despite the fact that those registers exist and can be used for several instructions. Is this a bug? Am I misunderstanding something?

@Amanieu
Copy link
Member Author

Amanieu commented Feb 10, 2022

You're right, we should allow these registers to be clobbered even if they cannot be used as operands. Also nice catch about r11, that was not intended. I will prepare a PR which fixes these issues.

@hudson-ayers
Copy link
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant 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.

10 participants