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

Proposal: Add Autocompress Control #122

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lenary
Copy link
Contributor

@lenary lenary commented Jan 10, 2025

These options allow users better control of when the assembler should turn specific instructions into their smaller equivalents, without having to change the enabled architectures.

A prototype LLVM implementation is available here: llvm/llvm-project#122483

These options allow users better control of when the assembler should
turn specific instructions into their smaller equivalents, without
having to change the enabled architectures.

Signed-off-by: Sam Elliott <[email protected]>
extension is enabled.

While this process does save static code size, there are circumstances where it
might not be wanted, and instead when assembly writers want exactly the
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the "when" in "instead when assembly writers" is unnecessary.

@psherman42
Copy link

Do we really need another option, when there are already existing options and best practices?

.option push
.option norvc
...
.option pop

@lenary
Copy link
Contributor Author

lenary commented Jan 11, 2025

Do we really need another option, when there are already existing options and best practices?

I put more motivation in the LLVM message, for which I apologise, I was writing both messages at the same time. From that motivation:


This will become more useful as the following things happen:

  • .option norvc is deprecated/removed (which is sometimes used for this purpose).
  • Extensions are added where the destination instruction cannot be disabled separately to the source instruction, either because the destination is in the base architecture, or because it is in the same extension as the source.
  • Extensions wider than 32-bits are added, which make CompressPats [the feature used to implement this in LLVM] more complex to use intuitively, especially if the destination is a 32-bit instruction.

This document says the following about .option norvc, which suggests it is not a best practice:

This option will be deprecated soon after .option arch has been widely implemented on main stream open source toolchains.

Another problem with .option (no)rvc is that it is stated to only disable/enable the C extension, and how it interacts with e.g. Zca/Zcf/Zcd is underspecified, not very obvious, and complex.

In short, yes I do think we need an option for controlling this feature.

I'll note that the proposed LLVM implementation correctly works with .option push and .option pop, which is maybe not obvious from the diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants