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

Auto compressing Zce instructions #30

Closed
abukharmeh opened this issue Nov 16, 2021 · 7 comments
Closed

Auto compressing Zce instructions #30

abukharmeh opened this issue Nov 16, 2021 · 7 comments
Assignees

Comments

@abukharmeh
Copy link

abukharmeh commented Nov 16, 2021

Hi,

I am testing Zce assembler, and it feels like the assembler does not check if it can use compressed Zce instructions.

For instance, trying the following assembly code:

not x15,x15
add x15,x0,x15

I would expect the assembler to generate two compressed instruction (c.not and c.mv), however, it generate a compressed instruction for the add and 32 bit instruction (xori -1) for c.not

image

Using Zce compressed instructions explicitly work, but auto compression should also work.

Kind regards,
Ibrahim.

@Xinlong-Wu Xinlong-Wu self-assigned this Nov 17, 2021
@Xinlong-Wu
Copy link
Collaborator

Xinlong-Wu commented Nov 17, 2021

Hi, Ibrahim

Yes, in fact, we are not optimising/compressing instructions at the assembly level.
We are generating Zce assembly instructions by changing the llvm IR instructions.
that's why the llvm-mc will not compress the code. it's only work is to generate the obj file.
You can try writing c source programs or LLVM IR programs to check the compression efficiency.
this link may helps you. https://www.wulongxin.com/index.php/archives/950/

Note: Inline assemblies are also not compressed

Yours sincerely ,
Wu Xinlong

@ScottEgerton
Copy link

ScottEgerton commented Nov 17, 2021

Hi,

Please correct me if I’m wrong but I believe that support for this kind of optimisation could be added in a similar fashion to what has been done here

def : CompressPat<(PUSH rlist3:$slist, alist:$areg, spimm0_5:$spimm),

Kind regards,
Scott

@Xinlong-Wu
Copy link
Collaborator

ok, we will take a try

@luke957
Copy link
Contributor

luke957 commented Nov 23, 2021

Hi,

Please correct me if I’m wrong but I believe that support for this kind of optimisation could be added in a similar fashion to what has been done here

def : CompressPat<(PUSH rlist3:$slist, alist:$areg, spimm0_5:$spimm),

Kind regards, Scott

Thanks for the infomation.

@luke957
Copy link
Contributor

luke957 commented Nov 23, 2021

Hi,

I am testing Zce assembler, and it feels like the assembler does not check if it can use compressed Zce instructions.

For instance, trying the following assembly code:

not x15,x15
add x15,x0,x15

I would expect the assembler to generate two compressed instruction (c.not and c.mv), however, it generate a compressed instruction for the add and 32 bit instruction (xori -1) for c.not

image

Using Zce compressed instructions explicitly work, but auto compression should also work.

Kind regards, Ibrahim.

For now we have implemented auto compression for zcee and NOT NEG, so you can try your assembly code again. We will try to fix other instructions during the following days. Thanks.

@abukharmeh
Copy link
Author

Excellent, thank you for that.

@abukharmeh
Copy link
Author

abukharmeh commented May 7, 2022

We appear to have a regression where we don't auto compress lb to cm.lb and like wise, while I expect them to be auto compressed ?
Edit: It appears to actually work, sorry !

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

No branches or pull requests

4 participants